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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -