Hi! I replied in the previous thread but it hasn't appeared in Google groups, just here: http://www.nabble.com/Selector-Madness!--How-to-Select-all-the-Text-on-a-Page--td17018965s27240.html So there is a translate plugin that works this way:
http://code.google.com/p/jquery-translate/ On May 5, 9:32 pm, Joe <[EMAIL PROTECTED]> wrote: > Last week I had a question on how to traverse the DOM and find all elements > that had some text (p, a, li, h1, etc.) so I could manipulate > it with Google's translation API. Well with some help from the > community I was able to accomplish this feat. > > http://groups.google.com/group/jquery-en/browse_thread/thread/c63da32... > > However, I have a bigger problem. Now, when I grab theallproperelements: > > $a = $(' #container > * ').contents(); > > And parse thru them tofindwhich ones have text, it does just that > BUT if an unordered list is within a div and that UL has text it will > show up not only with the UL, but within the DIV as well. > > $a.each(function() > { ... translate stuff here ..}); > > So in iteration one, wefindthe DIV, and then locate any andALLtext > in the DIV. Quite a bit for the header navigation. > > Example Result for Div: > HOME BUSINESS CONTACT ABOUT > > Then the next iteration is the UL, and it finds its text, which is > basically the same as the DIV's text result. > > Example Result for UL: > HOME BUSINESS CONTACT ABOUT > > Then the next iteration is the LI element, which has the proper text > but, > > The next iteration is the A element which is finally the text I > actually want to translate. > > Example Result for LI and A: > HOME > > So myquestionis how can Itraversedown and grab thelastchild on > that particular "branch" of theDOM. Surely there's a way to check if > current node has or does not have a child, but how with jQuery? > > Thanks! > > BTW, Ariel Fleisler's recommendation from the previous post appears to > be the best approach, but my pure Javascript mixing with jQuery skills > are not quite up to snuff to hash that out...