onchange - Jquery Want to retrieve value and print it -
i want select change: replace value in #yourdiscount discount='' of each option
<select name='purchase'> <option value='100 ' discount='95.05'>100 testów/ 1,045.50 pln</option> <option value='500 ' discount='567.39' selected>500 testów/ 4,350.00 pln</option> <option value='1000 ' discount='1,416.67'>1000 testów/ 8,500.00 pln</option> <option value='2500 ' discount='4,000.00'>2500 testów/ 20,000.00 pln</option> <option value='10000' discount='13,846.15'>10000 testów/ 60,000.00 pln</option> <option>inna ilość...</option> </select> </div> <div class='l' style='color:green;margin-top:3px'> <b>i rabat: <span id='yourdiscount'>567.39</span> pln</b></div>
any suggestions how this?
you attr('discount') of option in on('change'... event, this
$('select[name="purchase"]').on('change', function(){ var = $(this).find('option:selected').attr('discount'); $('#yourdiscount').text(a); });
Comments
Post a Comment