I think I already am, Andy. Here's my first few lines; do I need to do
something more? (And thanks, btw.)
$(function() {
/* Load the initial screen content */
$("#content").load("includes/sh4-welcome.cfm?nocache=<cfoutput>#getTickCount
()#</cfoutput>");
/* Assign the onclick event handler to all the images on
the keypad. */
$("#keypad img").click(function() {
...
_____
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Wednesday, February 07, 2007 2:12 PM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] jQuery operations on ajax data
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/