Shopify themes, liquid, logos, and UX
Hi all, I am very new to shopify and want to create a form with a drop down box whose items are dependent on another drop down box. Luckily, a solution to this problem has been posted online here:
Theres a few different solutions listed..I tried the first solution by adding the code to page.contact.liquid but I couldnt get it to work.
Below is the top solution posted on that link. I added the html code as is to my page.contact.liquid file, but I didnt know where to put the JS code.
Can someone please help make the code work for a "contact us" form on a shopify store? In case it matters, I am using the narrative theme.
Id appreciate all help! Thank you!!
HTML
<!-- Source: --> <select id="source" name="source"> <option>MANUAL</option> <option>ONLINE</option> </select> <!-- Status: --> <select id="status" name="status"> <option>OPEN</option> <option>DELIVERED</option> </select>
JS
$(document).on('ready', function () { $("#source").on('change', function () { var el = $(this); if (el.val() === "ONLINE") { $("#status").append("<option>SHIPPED</option>"); } else if (el.val() === "MANUAL") { $("#status option:last-child").remove(); } }); });
User | RANK |
---|---|
126 | |
92 | |
77 | |
70 | |
41 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022