I have a span
that contains text that I would like to use. But within this span
there is a h2
that I want to ignore. (This isnt my mark up and I cant change this so moving the h2
outside of the span
is not an option)
Here is the mark up:
<span>
<h2>Joe Bloggs</h2>
Executive Director
</span>
Here is my current code which is getting the contents of the span
including the h2
currentLi = $('ul#example2 li.frame3');
position = $(currentLi).find('span').text();
So my hopeful outcome will be the variable position
containing the text "Executive Director"