javascript - jQuery not changing value for input text with plus/minus button -


i have simple plus , minus button next input. works fine. however, it's not changing value once number set in form. causing problems since have calculator changes based on value of input. there way make jquery change actual value when plus/minus buttons used? can manually type number , works fine.

i have tried using .change() , .attr('value' currentval) no luck.

http://jsfiddle.net/zer00ne/v1pje44v/

you use this

change

var currentval = parseint($('input[name=' + fieldname + ']').val(); $('input[name=' + fieldname + ']').val(currentval + 1); $('input[name=' + fieldname + ']').val(10); $('input[name=' + fieldname + ']').val(currentval - 1); $('input[name=' + fieldname + ']').val(0); 

to

var currentval = parseint($('.qty').val()); $('.qty').val(currentval + 1); $('.qty').val(10); $('.qty').val(currentval - 1); $('.qty').val(0); 

this respective change work you.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -