Skip to content Skip to sidebar Skip to footer

How To Control Input Type Dropdown Select Options Menu With Jquery

I am creating a web site. In this web site , there is a form. I have added 3 dropdown menus in this form like below. Now I want to when someone selects the number 5 from Adults men

Solution 1:

Here is the solution as per your explanation:

$('#children').change(function() {
    var children = $('#children').val();
    var infants = $('#infants').val();
    var adults = $('#adults').val();
    var total_pending;
   if((parseInt(adults) + parseInt(children)) < totalAdultChild){
     total_pending = totalAdultChild - (parseInt(adults) + parseInt(children));
     new_infants = parseInt(infants) + parseInt(total_pending);
     $('#infants').val(new_infants);
   }
 });
});

DEMO: https://codepen.io/creativedev/pen/aKaJxW


Post a Comment for "How To Control Input Type Dropdown Select Options Menu With Jquery"