Jquery Create Event [www.erichynds.com]

The jQuery live event handler can monitor the DOM for changes and add event handlers to those elements that match a selector. It can not bind a function that fires when the DOM changes to check if a specific element has been added. Often when you need to work with third-party code, you might need to wait for an element to be added as the result of an Ajax request.

In this case you can use the create-event plugin. You can bind the create event to the eventual parent element where a new element will be created and trigger whatever code you need that relies on the new element's existence.

You can use this to add a plugin or just run some code:

// when a new div.foo element enters the DOM, call somePlugin() on it.
$("div.foo").live("create", function(){
$(this).somePlugin();
});

// when a new div.foo element enters the DOM, trigger some code.
$("div.foo").live("create", function(){
$(this).addClass('bar');
$(this).css('width','100%');
});
posted in ,

Re

I had heard a lot about j Query live and searched all over the internet to find an article on it. I found this article to be good and helpful.I accidentally came across this article and I found it to be helpful. Thanks a lot for this wonderful article.
http://www.fashionforplay.com

by casper red on 06/11/14

fotorise

Hi there. I really appreciate the points you made. I don't think I've actually thought about it in that way. I can really appreciate how you approached the subject matter and what you said really gave me a new perspective. Thanks for taking the time to write this all out. http://www.fotorise.com/blog

by Oh Mine on 07/23/14

Add comment