jquery - Add +1 to span and displaying am I doing this the hard way? -
i have feeling there easier way this, took me bit figure out. need remember javascript , php have similar syntax. can reduce this?
i tried $('span#'+venue).html(thisvenuecount++);
didn't work.
var thisvenuecount = $('span#'+venue).html(); thisvenuecount++; $('span#'+venue).html(thisvenuecount);
html
<span class="badge pull-right" id="69">1</span>
you shoud parse int first.
var venue = 69; $('span#'+venue).html(parseint($('span#'+venue).html()) + 1);
or even:
var el = $('#69'); el.html(parseint(el.html()) + 1);
Comments
Post a Comment