I have the following scenario where I need to get text from a specific id area, for instance, in this case I’d like to get the name of the person. I already know the id i.e. booking_11 as I’ve got this from the onClick:
<li id="booking_11">Name of person <span style="float: right;"><a href="#" id="11" class="dialog">View</a> | <a class="remove" id="rmCandidate_11" href="#">Remove</a></span></li>
To get only that
"Name of person"text node you can do this (without changing your markup):You can test it out here (broken up above to fit SO cleanly, it can be a one-liner).