I’m just trying to get a number from a hidden form input and plus 1 to that number and then put that value to the incremented number.
Here is my code
jQuery('#add_slider_image').live('click', function() {
var slideId = jQuery('#count-level').attr('value');
jQuery('#count-level').attr('value',slideId+1);
});
What am I doing wrong? as it changes the value to 11 or even 111 depending on the amount of clicks. It needs to add the value with 1. like 1+1=2 not 11.
Thanks
its converting it to a string. make sure to do
var slideId = parseInt(jQuery(‘#count-level’).attr(‘value’));