Hi! Here's a plugin that does it for you:
http://code.google.com/p/jquery-translate/
It grabs the text the way you described, but if a tag has childnodes and
textnodes too then it grabs its innerhtml. So i.e. if a paragraph has 'a'
tags inside then the paragraphs innerhtml will be translated. On larger
sites the looping unfortunately can take a couple of seconds but in most
cases it's bearable.



joemccann wrote:
> 
> 
> Okay I have read and reread
> http://www.learningjquery.com/2006/11/how-to-get-anything-you-want-part-1
> 
> and
> 
> http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2
> 
> and still cannot figure out how to grab all the text (not the markup)
> on a page.  I am toying with the Google Translation API and am
> attempting to parse all text, translate, and put it back.  I have the
> looping logic (and the 500 char limit issue with Google) sorted out,
> but I can't get the fundamental part down...GRABBING ALL THE TEXT.
> 
> So let's say you have markup like so
> 
> <ul>
> <li> somelink blabh blah 1 </li>
> <li> somelink blabh blah 2 </li>
> <li> somelink blabh blah 3 </li>
> </ul>
> 
> and even
> 
> <h1>some heading</h1>
> 
> and
> 
> <p>Some paragraph text</p>
> 
> etc. etc.
> 
> I want to be able to grab all the text and manipulate it.
> 
> I've tried $("#mainContainerDiv *").each(...some function....), but
> this crashed the system.
> 
> I would like to do something like this:
> 
> $("#mainContainerDiv *.text".each(....some function...), but this
> clearly won't work.
> 
> Any help is greatly appreciated.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Selector-Madness%21--How-to-Select-all-the-Text-on-a-Page--tp17018965s27240p17043744.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to