I am trying to make a button that increases when I click on its identifier and variable. I was able to find some code in StackOverflow that increases the value of the input field, but I don't know how to change it.
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); </script>
This increases the value of val in the input, but I cannot get it to increment the class $ ('# inc') and var incrementVar.
What should I do? Thanks you
source share