You just have to reassign the function to the images after you load in
content.

  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul
Sent: Wednesday, February 07, 2007 3:14 PM
To: 'jQuery Discussion.'
Subject: [jQuery] jQuery operations on ajax data



I'm using jQuery to assign a function to every image within a div on my
page:

 

$("#keypad img").click(function() { ...

 

It worked great, until I set about organizing the screens in my single-page
application.  I want to load the content dynamically as a user moves about
the application, so I'm trying to initialize the first screen like so:

 

$("#content").load("includes/sh4-welcome.cfm");

 

This renders the html properly, but it breaks the jQuery click function I
was assigning to the images. (The #keypad div is within the file being
loaded at runtime.)  There aren't any JS errors, but nothing happens when I
click.  If I remove the ajax call, and instead put the data back inline the
good old-fashioned way, the click functions work again.

 

Is there a rule I don't know about using jQuery functions on ajax-loaded
data?

 

-Paul

 

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to