Shopify Drop down Validation

New Member
1 0 0

I'm building a web store on shopify. I want to add a validation to dropdown that if no size/value is selected from drop down, it automatically select 1st size/value. when we click on add to cart button.



Shopify Expert
164 34 56

<select id="drop">
   <option value="0">Please select</option>
   <option value="1">One</option>
   <option value="2">Two</option>
   <option value="3">Three</option>
<button id="add">Add to cart</button>
Use this javascript/jQuery:$(document).ready(function() {
   var $drop = $("#drop");
   $("#add").on("click", function() {
       if($drop.val() == 0) {

Problem Solved? ✔️Accept the solution so you can help others.
* Email: * Skype: fayyaz_raza
1 Like