[Greasemonkey] Grab text string in TD
zboogs at gmail.com
Thu Apr 21 16:45:33 EDT 2005
The easiest way is with the nonStandard, but useful textContent property.
Incidentally, <td> elements don't have an attribute named value, which
is why what you were trying to do did not work. But even if it did,
what you're looking for is not an attribute but the textual content of
DOM elements don't contain text directly, but text nodes, which in
turn contain the text. So the official way to do what you want would
assuming that the first child is a text node and there are no other
child elements. The whole thing gets pretty messy which is why I
On 4/21/05, Dave <relaxedguy at gmail.com> wrote:
> I am figuring out how to remove tables from pages and most of the
> sites I want to do this to are pretty stingy with div's ID's, names,
> I am stumped on how to find a <td> cell that contains a particular string.
> I am iterating through a list of <td>'s and attempting to use the
> match function to find which <td> starts with the word "Special".
> I GetElements ByTagName, then for each one:
> if (td1.getAttribute('value').match(/^Special/))
> I can't figure out the proper syntax for this. I think that 'value' is
> incorrect but after rtfm'ing for a while I'm still stumped.
> references in regards to GM?
> My list so far:
> Dave Evans
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
More information about the Greasemonkey