[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread AJ

By coincidence, I was about to post a very similar issue today. It
seems that any time I include content via ajax, and that content also
needs to use jQuery functions from the containing page, the content
included via ajax seems to lose the functions.

I've tried and tried to find fixes for this, to no avail. And it seems
to happen all the time. Is this always a binding issue?



[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread Klaus Hartl


AJ wrote:

By coincidence, I was about to post a very similar issue today. It
seems that any time I include content via ajax, and that content also
needs to use jQuery functions from the containing page, the content
included via ajax seems to lose the functions.

I've tried and tried to find fixes for this, to no avail. And it seems
to happen all the time. Is this always a binding issue?


Yes. Event handlers are not lost, they're just not there, because the 
content that gets loaded and inserted into the document wasn't there 
when these handlers were attached the first time.


Brandon is working on a behavior plugin, that takes care of that and 
will bind handlers automatically.



--Klaus



[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread Brandon Aaron

On 6/21/07, Klaus Hartl [EMAIL PROTECTED] wrote:


Brandon is working on a behavior plugin, that takes care of that and
will bind handlers automatically.




It is true and it will be officially released once jQuery 1.1.3 is released.
If you don't mind using jQuery 1.1.3 alpha and getting your hands dirty with
inline docs and minimal examples ... then you can start using it now.

You can grab the latest here: http://jquery.com/plugins/project/behavior
And see the example/test here:
http://brandonaaron.net/jquery/plugins/behavior/test/test.html

--
Brandon Aaron


[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread AJ


 It is true and it will be officially released once jQuery 1.1.3 is released.
 If you don't mind using jQuery 1.1.3 alpha and getting your hands dirty with
 inline docs and minimal examples ... then you can start using it now.

Wow, thanks! I am in a real crisis with a site right now, so I'll go
ahead and try it with 1.1.3 and see how it goes.

Will post any findings here later tonight.

AJ



[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread Brandon Aaron

I would highly suggest grabbing the latest from SVN instead of the jQuery
1.1.3a download.

--
Brandon Aaron

On 6/21/07, AJ [EMAIL PROTECTED] wrote:




 It is true and it will be officially released once jQuery 1.1.3 is
released.
 If you don't mind using jQuery 1.1.3 alpha and getting your hands dirty
with
 inline docs and minimal examples ... then you can start using it now.

Wow, thanks! I am in a real crisis with a site right now, so I'll go
ahead and try it with 1.1.3 and see how it goes.

Will post any findings here later tonight.

AJ




[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread Klaus Hartl


AJ wrote:



It is true and it will be officially released once jQuery 1.1.3 is released.
If you don't mind using jQuery 1.1.3 alpha and getting your hands dirty with
inline docs and minimal examples ... then you can start using it now.


Wow, thanks! I am in a real crisis with a site right now, so I'll go
ahead and try it with 1.1.3 and see how it goes.


Being in a crisis is not the right time to play with nightly builds ;-)




--Klaus


[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread Aaron Heimlich

If you need something that works *right now* with 1.1.2, I suggest you take
a look at event delegation[1].

[1] http://icant.co.uk/sandbox/eventdelegation/

On 6/21/07, Klaus Hartl [EMAIL PROTECTED] wrote:



AJ wrote:

 It is true and it will be officially released once jQuery 1.1.3 is
released.
 If you don't mind using jQuery 1.1.3 alpha and getting your hands dirty
with
 inline docs and minimal examples ... then you can start using it now.

 Wow, thanks! I am in a real crisis with a site right now, so I'll go
 ahead and try it with 1.1.3 and see how it goes.

Being in a crisis is not the right time to play with nightly builds ;-)




--Klaus





--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com


[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread Karl Swedberg

This issue comes up repeatedly, and I keep posting this link:

http://docs.jquery.com/Tutorials:AJAX_and_Events

If you read it all the way through, I think you'll get a good  
understanding of event binding and a few ways to bind events at the  
right time.


Also, a quick search in this google group for ajax events would  
lead you to some good answers.


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Jun 21, 2007, at 9:57 AM, AJ wrote:




It is true and it will be officially released once jQuery 1.1.3 is  
released.
If you don't mind using jQuery 1.1.3 alpha and getting your hands  
dirty with

inline docs and minimal examples ... then you can start using it now.


Wow, thanks! I am in a real crisis with a site right now, so I'll go
ahead and try it with 1.1.3 and see how it goes.

Will post any findings here later tonight.

AJ





[jQuery] Re: Ajax call - lost event handlers

2007-06-21 Thread AJ


 Bind the change event again in the Ajax callback, like this:

Klaus,

I ended up using a modified version of your suggestion and it worked
great. Thanks!

AJ