Rowan Reid wrote:
> Hi There,
>
> I am using Ajax.Updater to update a div with XHTML content.  Some of
> the elements within this content have ids assigned.
>
> Once I create an Ajax_Updater to update the div and then try and
> access any elements from within the new content using their IDs
> (either using $() or document.getElementById) I get an error that the
> element does not exist.
>
> Any ideas?
You need to use defer or setTimeout to allow the browser enough time to 
parse the html you just inserted.  Example:

$('mydiv').innerHTML = '<span id="name1">John Smith</span>';
(function() {
  $('name1').observe('click', mycallback);
}).defer();


- Ken Snyder

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to