I\'m using jQuery to retrieve a value submitted by an input button. The value is supposed to be an integer. I want to increment it by one and display it.
//
Use parseInt as in: var count = parseInt($("#"+countUp).val(), 10) + 1; or the + operator as in var count = +$("#"+countUp).val() + 1;
var count = parseInt($("#"+countUp).val(), 10) + 1;
+
var count = +$("#"+countUp).val() + 1;