getting BR-separated text via DOM in JS/JQuery?
- by Hellion
Hi all, I am writing a greasemonkey script that is parsing a page with the following general structure:
<table>
<tr><td><center>
<b><a href="show.php?who=IDNumber">(Account Name)</a></b>
(#IDNumber)
<br> (Rank)
<br> (Title)
<p>
<b>Statistics:</b>
<br>
<table>
<tr><td>blah blah etc.
</td></tr></table></center></table>
I'm specifically trying to grab the (Title) part out of that. As you can see, however, it's set off only by a <BR> tag, has no ID of its own, is just part of the text of a <CENTER> tag, and that tag has a whole raft of other text associated with it.
Right now what I'm doing to get that is taking the innerHTML of the Center tag and using a regex on it to match for /<br>([A-Za-z ]*)<p><b>Statistics/. That is working okay for me, but it feels like there's gotta be a better way to pick that particular text out of there.
... So, is there a better way? Or should I complain to the site programmer that he needs to make that text more accessible? :-)