To 'live' or not to 'live'?

by Steven Datt on 9 March 2011
My colleague Paul and I have been discussing a feature of the jQuery library that really helps when adding events to a web page. Historically using the click event or binding events to dynamic content could be tricky. This is because it’s possible to bind more than one event to an element. Care needs to be taken otherwise another event might be added to existing elements on the page. The live event handler is an alternate method to bind or click, for example: $("li").live("click",function(){ // code here }); This means all current and future list items will now have this event handler bound to them. This is great because there’s no longer the need to manage bound events to new content. Which got us arguing, what does ‘live’ stand for? Is it:
‘live’ – meaning it handles event binding on the fly as new elements are added, rather than having to call a function that binds events to the new items after finishing (think how a football match can be aired live - it's happening in real time)


‘live’ – is an event that lives on regardless of whether content is generated or existing.


Let us know before this gets ugly! – just leave a comment below saying which of us you think is right – or even giving us your own take on it!

Thank you for your comment. It has been submitted for approval.

Comment Again?

Leave a comment

Please enter your name.
Sorry, this email address is not valid.
Please enter your comment.

Course basket x


Price per place

Add another courseCheckout

Pay now by credit card or later by invoice (invoice payments only possible if all courses are 3+ weeks in advance)