html select - How to determiine which dropdown was used -


i have form more 1 dropdown list, below. can see how id's of each dropdown can't figure out how 1 used. explain how that, please.

  <div>    <select name="id[11]" class="pulldown" id="attrdrop0">     <option class="pink" value="31`">no</option>     <option class="pink" value="32">yes (+$40.00)</option>    </select>   </div>     <div>    <select name="id[10]" class="pulldown" id="attrdrop1">     <option class="pink" value="31">no</option>     <option class="pink" value="32">yes (+$150.00)</option>    </select>   </div>   <script>   $(function () {    $("#prices").change(function () {      console.log('a change made');      calculateprice();     }); });    function calculateprice() {     var ttl_price = 0;     var id = '';      $(":input.select, :input").each(function() {        var cur_price = $('option:selected', $(this)).text();        ttl_price += cur_price;             id = $(this).attr('id');        /*** ***/     });       setprice(id, ttl_price);     }   </script> 

you can pass control parameter calculateprice.

$(function () {    $("#prices").change(function () {      console.log('a change made');      calculateprice(this);     }); });    function calculateprice(triggerobject) {     var ttl_price = 0;     var id = '';      $(":input.select, :input").each(function() {        var cur_price = $('option:selected', $(this)).text();        ttl_price += cur_price;             id = $(this).attr('id');        /*** ***/        if (triggerobject.id) {...}     });       setprice(id, ttl_price);     }   </script> 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -