View Full Version : Find Container Tag

05-21-2008, 03:06 PM
First of all, AHHHHHH! Okay, now that that is out of the way, lets continue.

I need to know how to create a JavaScript that will find out what and where the tag/tags is/are that contain the text "$body". For example:

The JavaScript would need to return a reference for the second div and the third td so that they can be manipulated.
Does all of that make sense?

I am not looking for actual code so much as direction (but if you feel compelled to write the script, I won't turn you down :)). I am pretty competent at writing in JavaScript, but I've never done this before.

05-21-2008, 06:30 PM
Stand by, I think I may have figured it out. :)

05-21-2008, 06:43 PM
you could do a indexOf() search to find the string, save it to a variable then grab the parent tag... however that will just tell you what type of tag it is, unless you a way to uniquely identify it from the rest of the tags surrounding it, it would be hard to replicate it unless you wanted to do that immediately.