I am trying to do a button that increments on click his ID and a variable. i was able to find some code on StackOverflow that increases the value of an input field but I do not know to change it from there.
Here is the Markup:
<input type="text" name="qty" value="0" />
<p id="inc">Increase</p>
<p id="dec">Decrease</p>
And jQuery
<script>
$(document).ready(function()
{
$(function()
{
$("#inc").click(function()
{
$(":text[name='qty']").val(Number($(":text[name='qty']").val()) + 1);
$('#inc').addClass (Number + 1); // this one does not work
var incrementVar = (Number + 1); // this one also does not work
});
$("#dec").click(function()
{
$(":text[name='qty']").val(Number($(":text[name='qty']").val()) - 1);
});
});
});
</script>
This does increase the val in the input but I can not make it to increment the $('#inc') class and the var incrementVar.
What should I do? Thank you