Option Selected

New Member
3 0 0

I have design a t-shirt for multiple styles.


Example: If someone visits "v-neck t-shirt" product page, but he needs a "unisex hoodie", he will need to choose "unisex hoodie" on the style and will refresh the page to a "unisex hoodie" product page

 

I added this code on description products for to can visitor choosing a style:

 

<div>
<span>Style</span>
<select onchange="la(this.value)">
<option value="/products/thomas-t-shirt-baby-t-shirt">Baby T-shirt</option>
<option value="/products/thomas-t-shirt-babygrow">Babygrow</option>
<option value="/products/thomas-t-shirt-kids-hoodie">Kids Hoodie</option>
<option value="/products/thomas-t-shirt-kids-sweatshirt">Kids Sweatshirt</option>
<option value="/products/thomas-t-shirt-kids-t-shirt">Kids T-shirt</option>
<option value="/products/thomas-t-shirt-mens-long-sleeved-t-shirt">Men's Long Sleeved T-Shirt</option>
<option value="/products/thomas-t-shirt-mens-t-shirt">Men's T-Shirt</option>
<option value="/products/thomas-t-shirt-mens-tank-top">Men's Tank Top</option>
<option value="/products/thomas-t-shirt-mens-v-neck-t-shirt">Men's V-Neck T-Shirt</option>
<option value="/products/thomas-t-shirt-premium-mens-t-shirt">Premium Men's T-shirt</option>
<option value="/products/thomas-t-shirt-premium-womens-t-shirt">Premium Women's T-shirt</option>
<option value="/products/thomas-t-shirt-unisex-hoodie">Unisex Hoodie</option>
<option value="/products/thomas-t-shirt-unisex-sweatshirt">Unisex Sweatshirt</option>
<option value="/products/thomas-t-shirt-womens-t-shirt">Women's T-shirt</option>
<option value="/products/thomas-t-shirt-womens-v-neck-t-shirt">Women's V-Neck T-Shirt</option>
</select>
</div>
<script>
function la(src)
{
window.location=src;
}
</script>

<!-- split -->

But the problem does not keep the option selected after the refresh page. I want to keep the option selected after the refresh page.

 

I'm using Turbo theme.

 

Can you help or guide me!

 

Many Thanks

0 Likes
Highlighted

give default selected attribute in option html 

Shopify theme developer and customization

I Would like to add new functionality or customize an existing one, please hire me.
If helpful then please Like and Accept Solution .
Email: ashiquehussaincodediary@gmail.com

0 Likes