views:

45

answers:

1

So I've managed to get stuck using Prototype for a Project, and so far I can't stand it.

All I want to do, is replace a title within a very specific place - it has no ID and I can't change the HTML, since it's not hosted by me.

Event.observe(window, 'load', function() {
    $$('#page #container .content .frame .entry h3.entry-title').update('Hello');
    $$('#page #container .content .frame .entry h3.entry-title').innerHTML;
});

Nothing happens with the script above, yet I know Prototype can pick up the <h3 class="entry-title"> because document.title = $$('#page #container .content .frame .entry h3.entry-title').length; displays 1.

What am I missing here?

+1  A: 

try

$$('#page #container .content .frame .entry h3.entry-title')[0].update('Hello');

Your selector return value seems to be a prototype object/array. Catch the first entry with [0] and apply update().

powtac
A right, I see, so $$ will return an object/array - hence why you have to iterate through multiple finds. That makes sense, thanks!
jakeisonline