javascript - Dynamic update to .li text -


i needing .li update text in response user's selections. there 3 toggle switches (which adjust .li no problems), 2 sets of radio buttons, , html5 slider. 2 sets of radio buttons , slider work great , display resulting value in div.

what need value displayed in div added value in .li , adjusted whenever user changes radio selection or moves slider (just in value displayed in div).

i have .li:

<li id="pricing" class="price"><i>$</i><span>850</span></li> 

this code makes switches change text in .li according position of each switch:

(function($){ $(function(){ $('.cmn-toggle').each(function () { $(this).change(function() { var curr_class = '.' + $(this).attr('id'); var price = $(this).attr('data-price'); var price_box = $('.pricing-table li.price span'); $(curr_class).toggleclass('active'); if (price) {   if ($(curr_class).hasclass('active')) {     price_box.html(parseint(price_box.html()) + parseint(price));   }   else {     price_box.html(parseint(price_box.html()) - parseint(price));   } } }); }); }); })(jquery); 

this code takes value of user selections each set of radios , slider , displays in div:

function calculatetotal(){ var multi = document.getelementbyid('textinput').value; var arr = document.getelementsbyname('selectmedia'); var arry = document.getelementsbyname('selectlength'); var tot=0; for(var i=0; i<arr.length; i++){     if(arr[i].checked){         tot += number(arr[i].value);     } } for(var i=0; i<arry.length; i++){     if(arry[i].checked){         tot += number(arry[i].value);     } }    document.getelementbyid('totalprice').innerhtml = tot * number(multi); } 

what need dynamically update .li based on value in totalprice? if .li 850 , totalprice changed 37 .li needs display 887. if totalprice changed 100 .li needs read 950.

a jsfiddle rest of code used.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -