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.
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
Post a Comment