<div id="content_heading">
<span id="status">
<h1><em>Some Element</em></h1>
</span>
</div>
I wanted to get h1
and $('span h1')
is not working.
Also $$('h1')
returns an array and i can get first element from array as $$('h1')[0]
Is there any way to find more accurate element something like $('div#content_heading span h1')
?
Make sure you run the code after DOM is ready:
document.observe("dom:loaded", function(){
var header = $$("span h1")[0];
});
See example here.