I tried to cut corners by skimming your html.  I see it now.  The divs close
and the text is after the div.
This is really strange HTML to me.  Why not just put the text inside the
div?  Or just wrap the text inside a span?
If you wrap the text inside spans, then the jQuery is pretty simple.  I
whipped up a sample.

http://commadot.com/jquery/findTextElements.php

$("#tln21").next("span").addClass("highlight")

Sometimes, fancy JS is not as good as clean html.

Glen

On Mon, May 5, 2008 at 6:51 PM, darren <[EMAIL PROTECTED]> wrote:

>
> hi glen, thanks for replying.
>
> That still wouldn't work. With that you are looking for the text
> inside div elements which are descendants of of the id'd element.
> What i want to select are certain text elements of the id'd element.
> I figured something out, but this is surprisinlgy difficult:
>
> <div id="21">
> <div>
> <text node>
> <div>
> <text node>
> ...
> </div>
>
> I had to use .contains() and [nodeType=3] to pick text nodes.  not
> pretty.
>
> On May 5, 4:23 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> > $("#tln21 div").text();
> >
> > Like that?  By the way, firebug is very helpful to test our selectors and
> > see what they come up with.
> > Hmm, it would be nice to have a tutorial on how to do this.  I can try
> and
> > whip one up.
> >
> > Glen
> >
> > On Mon, May 5, 2008 at 2:47 PM, darren <[EMAIL PROTECTED]> wrote:
> >
> > > hi Joe, thanks for your comment
> >
> > > If you look closer, you can see that the text is not actually in the
> > > div element.  i basically need to select the text after that node:
> >
> > > <div>
> > >   <div tln=xxx></div>
> > >   Some text
> > >   <div tln=xxx></div>
> > >   some more text
> > >   <div tln=xxx3></div>
> > >   even more text
> > > </div>
> >
> > > So that wouldnt work
> >
> > > On May 5, 2:06 pm, Joe <[EMAIL PROTECTED]> wrote:
> > > > $("#tln21').text();
> >
> > > > This will return the text associated with id="tln21".
> >
> > > >http://docs.jquery.com/Attributes/text
> >
> > > > Joe
> >
> > > >www.subprint.com
> >
> > > > On May 5, 2:34 pm, darren <[EMAIL PROTECTED]> wrote:
> >
> > > > > Hi everybody, new member here.
> >
> > > > > I have a project with the following snipped of code:
> >
> > > > > =====start html=====
> > > > > <div class="line">
> > > > >                               <div name="tln4" id="tln4" class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>As I remember, Adam, it was
> upon
> > > > > this fashion
> > > > >                               <div name="tln5" id="tln5" class="ln
> > > > > tln">5</div>bequeathed me by will but poor a thousand
> > > > >                               <div name="tln6" id="tln6" class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>crowns, and, as thou say'st,
> > > > > charged my brother,
> > > > >                               <div name="tln7" id="tln7" class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>on his blessing, to breed me
> well;
> > > > > and
> > > > >                               <div name="tln8" id="tln8" class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>there begins my sadness. My
> > > > > brother Jaques he keeps
> > > > >                               <div name="tln9" id="tln9" class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>at school, and report speaks
> > > > > goldenly of his profit.
> > > > >                               <div name="tln10" id="tln10"
> class="ln
> > > > > tln">10</div>For my part, he keeps me rustically at home, or, to
> > > > > speak
> > > > >                               <div name="tln11" id="tln11"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>more properly, stays me here at
> > > > > home unkept; for call
> > > > >                               <div name="tln12" id="tln12"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>you that "keeping" for a
> gentleman
> > > > > of my birth that differs
> > > > >                               <div name="tln13" id="tln13"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>not from the stalling of an ox?
> > > > > His horses are bred
> > > > >                               <div name="tln14" id="tln14"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>better, for, besides that they
> are
> > > > > fair with their feeding,
> > > > >                               <div name="tln15" id="tln15"
> class="ln
> > > > > tln">15</div>they are taught their man�ge, and to that end riders
> > > > >                               <div name="tln16" id="tln16"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>dearly hired; but I, his
> brother,
> > > > > gain nothing under
> > > > >                               <div name="tln17" id="tln17"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>him but growth, for the which
> his
> > > > > animals on his
> > > > >                               <div name="tln18" id="tln18"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>dunghills are as much bound to
> him
> > > > > as I. Besides this nothing
> > > > >                               <div name="tln19" id="tln19"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>that he so plentifully gives
> me,
> > > > > the something that
> > > > >                               <div name="tln20" id="tln20"
> class="ln
> > > > > tln">20</div>nature gave me his countenance seems to take from
> > > > >                               <div name="tln21" id="tln21"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>me. He lets me feed with his
> > > > > hinds, bars me the
> > > > >                               <div name="tln22" id="tln22"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>place of a brother, and as much
> as
> > > > > in him lies, mines my
> > > > >                               <div name="tln23" id="tln23"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>gentility with my education.
> This
> > > > > is it, Adam, that
> > > > >                               <div name="tln24" id="tln24"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>grieves me; and the spirit of
> my
> > > > > father, which I think
> > > > >                               <div name="tln25" id="tln25"
> class="ln
> > > > > tln">25</div>is within me, begins to mutiny against this servitude.
> > > > >                               <div name="tln26" id="tln26"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>I will no longer endure it,
> though
> > > > > yet I know no wise
> > > > >                               <div name="tln27" id="tln27"
> class="ln
> > > > > tln">
> > > > >                                  <!---->
> > > > >                               </div>remedy how to avoid it.
> > > > >                               <!---->
> > > > >                            </div>
> > > > > ====End HTML====
> >
> > > > > I have a short selection of text and a tln that the text should be
> > > > > found near.  I wan to use jquery to find this text node so that i
> can
> > > > > manipulate it.  My trouble is that I dont understand how the DOM
> > > > > treats text nodes and element nodes.
> >
> > > > > So say for example i had the information (tln21) and a text snippet
> > > > > "He lets me".  What i tried was:
> > > > > $("#tln21').siblings()
> > > > > But this is only returning element siblings, not text siblings.
> >
> > > > >   what can i do here? thanks for any help.
>

Reply via email to