views:

25

answers:

2

HI ,

I am using JQuery 1.3 , i am facing problem in using live event as in jqyery . DOM element "context" is bound to default document root. so how to overcome such thing ?

Note :

As of jQuery 1.4, live events can be bound to a DOM element "context" rather than to the default document root. To set this context, we use the jQuery() function's second argument, passing in a single DOM element (as opposed to a jQuery collection or a selector).

A: 

Upgrade to 1.4.2 and use $('#foo', '#bar').live().

meder
Well , i have restriction not to upgrade and if i do use this in jquery 1.3 then whenever i will clone the HTML Block then newly cloned block would failed to receive event - even i am changing the class name for newly cloned block.
Hunt
+1  A: 

Either upgrade to 1.4, or write a plugin that provides a context with live events. Copy the source from jQuery 1.4 for that plugin if need be.

Anurag
i dont know what part to copy ?, can u please help me in that
Hunt
Search for the line that contains `jQuery.each(["live", "die"]`. That is where `live` is being defined in 1.4.2. Pay close attention to the use of `context` variable in it. Start tracing from there.
Anurag