dan.codes
dan.codes

Reputation: 3523

Prototype JS: Can't get Element.update to work on element with a class

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)

Upvotes: 0

Views: 639

Answers (1)

Jeff Fohl
Jeff Fohl

Reputation: 2076

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

Element.update(notice[0], transport.responseText)

Upvotes: 1

Related Questions