when to use bind() instead of live() jquerymobile

Posted: February 3, 2012 in web

The code below gets triggered every page transition of jqm. This resides on a separate aspx file using ScriptManager.RegisterClientScriptBlock. Everytime the user hits the back button and go back to this same page, it will bind that same function to that object in the DOM. So if you have a validation inside, it will validate twice or more and you will get multiple validation alert box.

$('#parkreport').live('pagecreate', function (event) {

to solve it, use bind.

$('#parkreport').bind('pagecreate', function (event) {

a good explanation of this


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s