How do i add one to the value of a text field? For example, quantity? This is how i get the object from the DOM - what do i do from here?
$(this).parent("div").children("input").val();
This is the value of my text field :)
How do i add one to the value of a text field? For example, quantity? This is how i get the object from the DOM - what do i do from here?
$(this).parent("div").children("input").val();
This is the value of my text field :)
Using jQuery, also handling the empty condition when there is no value present
inp = $("#inputId");
var orgValue = parseInt(inp.val() == "" ? "0" : inp.val());
inp.val((orgValue == NaN ? 0 : orgValue) + 1);
var elm = $(this).parent("div").children("input");
var val = elm.val();
val = Number(val) == NaN ? 0 : Number(val);
elm.val(val + 1);