views:

110

answers:

1

I am trying to add the ajax response text, to a div that has a class on it, and not an id. I try the following:

var notice = $$('.testdiv');
Element.update(notice, transport.responseText)

This doesn't work but if I change it to update an element that has an ID on it, it works.

var notice = $('testdiv');
Element.update(notice, transport.responseText)
+1  A: 

This is because $$('.testdiv') is returning an array. Try this:

Element.update(notice[0], transport.responseText)
Jeff Fohl
Thanks, that worked perfectly. I am use to jQuery and didn't realize that. It makes sense
dan.codes