I have a little DIV like this:
<div id="counter">2</div>
I’d like to use jQUery to either subtract or add by let say 1, resulting in 3 or 1…
is there a way in jquery to do this? convert a string to a int maybe?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Example for addition: http://jsfiddle.net/2uBMy/
Example for subtraction: http://jsfiddle.net/2uBMy/1/
To add a check for negative, you could do this: