[jQuery] Re: need some help with selecting text nodes

2008-05-07 Thread Glen Lipka
What about doing is client-side?
So cycle through each line with each() and then use .wrap("").
This will put into the DOM what you need to use later.

Also, you might be interested in this plugin.
http://www.jquery.info/The-plugin-SearchHighlight

It finds text based on search criteria in a large block of random text.
It might be useful.

Glen


On Tue, May 6, 2008 at 6:44 PM, darren <[EMAIL PROTECTED]> wrote:

>
> oh man, i wish i could do as you suggested, that was my first idea and
> it would make things so much easier.  However, the code i'm working
> with is markup of Shakespeare's works.  Its incredibly complex and we
> use Cocoon to generate these pages from xml.  long story short, my
> employer can't afford to make such a change now so I have to make due
> with what's there.  I think i came up with a reasonable solution
> though:
>
> 1. Find the div with the lower tln value. Then get its index with
> respect to the parent.
> 2. Find the next highest div tln and get its index as well.
> 3. From this we know the text node lies within the indexes, so search
> for the text there.
>
> Again, because of the code complexity, this does not always work, but
> at least i'm making progress.  Thanks for your insight though.
>
>
>
> On May 6, 9:28 am, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> > 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:
> >
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ...
> > > 
> >
> > > 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:
> >
> > > > > 
> > > > >   
> > > > >   Some text
> > > > >   
> > > > >   some more text
> > > > >   
> > > > >   even more text
> > > > > 
> >
> > > > > 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=
> > > > > > > 
> > > > > > >class="ln
> > > > > > > tln">
> > > > > > >  
> > > > > > >   As I remember, Adam, it was
> > > upon
> > > > > > > this fashion
> > > > > > >class="ln
> > > > > > > tln">5bequeathed me by will but poor a thousand
> > > > > > >class="ln
> > > > > > > tln">
> > > > > > >  
> > > > > > >   crowns, and, as thou
> say'st,
> > > > > > > charged my brother,
> > > > > > >class="ln
> > > > > > > tln">
> > > > > > >  
> > > > > > >   on his blessing, to breed
> me
> > > well;
> > > > > > > and
> > > > > > >class="ln
> > > > > > > tln">
> > > > > > >  
> > > > > > >   there begins my sadness. My
> > > > > > > brother Jaques he keeps
> > > > > > >class="ln
> > > > > > > tln">
> > > > > > >  
> > > > > > >   at school, and report
> speaks
> > > > > > > goldenly of his profit.
> > > 

[jQuery] Re: need some help with selecting text nodes

2008-05-06 Thread darren

oh man, i wish i could do as you suggested, that was my first idea and
it would make things so much easier.  However, the code i'm working
with is markup of Shakespeare's works.  Its incredibly complex and we
use Cocoon to generate these pages from xml.  long story short, my
employer can't afford to make such a change now so I have to make due
with what's there.  I think i came up with a reasonable solution
though:

1. Find the div with the lower tln value. Then get its index with
respect to the parent.
2. Find the next highest div tln and get its index as well.
3. From this we know the text node lies within the indexes, so search
for the text there.

Again, because of the code complexity, this does not always work, but
at least i'm making progress.  Thanks for your insight though.



On May 6, 9:28 am, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> 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:
>
> > 
> > 
> > 
> > 
> > 
> > ...
> > 
>
> > 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:
>
> > > > 
> > > >   
> > > >   Some text
> > > >   
> > > >   some more text
> > > >   
> > > >   even more text
> > > > 
>
> > > > 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=
> > > > > > 
> > > > > >   
> > > > > >  
> > > > > >   As I remember, Adam, it was
> > upon
> > > > > > this fashion
> > > > > >   5bequeathed me by will but poor a thousand
> > > > > >   
> > > > > >  
> > > > > >   crowns, and, as thou say'st,
> > > > > > charged my brother,
> > > > > >   
> > > > > >  
> > > > > >   on his blessing, to breed me
> > well;
> > > > > > and
> > > > > >   
> > > > > >  
> > > > > >   there begins my sadness. My
> > > > > > brother Jaques he keeps
> > > > > >   
> > > > > >  
> > > > > >   at school, and report speaks
> > > > > > goldenly of his profit.
> > > > > >> class="ln
> > > > > > tln">10For my part, he keeps me rustically at home, or, to
> > > > > > speak
> > > > > >> class="ln
> > > > > > tln">
> > > > > >  
> > > > > >   more properly, stays me here at
> > > > > > home unkept; for call
> > > > > >> class="ln
> > > > > > tln">
> > > > > >  
> > > > > >   you that "keeping" for a
> > gentleman
> > > > > > of my birth that differs
> > > > > >> class="ln
> > > > > > tln">
> > > > > >  
> > > > > >   not from the stalling of an ox?
> > > > > > His horses are bred
> > > > > >

[jQuery] Re: need some help with selecting text nodes

2008-05-06 Thread Glen Lipka
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:
>
> 
> 
> 
> 
> 
> ...
> 
>
> 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:
> >
> > > 
> > >   
> > >   Some text
> > >   
> > >   some more text
> > >   
> > >   even more text
> > > 
> >
> > > 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=
> > > > > 
> > > > >   
> > > > >  
> > > > >   As I remember, Adam, it was
> upon
> > > > > this fashion
> > > > >   5bequeathed me by will but poor a thousand
> > > > >   
> > > > >  
> > > > >   crowns, and, as thou say'st,
> > > > > charged my brother,
> > > > >   
> > > > >  
> > > > >   on his blessing, to breed me
> well;
> > > > > and
> > > > >   
> > > > >  
> > > > >   there begins my sadness. My
> > > > > brother Jaques he keeps
> > > > >   
> > > > >  
> > > > >   at school, and report speaks
> > > > > goldenly of his profit.
> > > > >class="ln
> > > > > tln">10For my part, he keeps me rustically at home, or, to
> > > > > speak
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   more properly, stays me here at
> > > > > home unkept; for call
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   you that "keeping" for a
> gentleman
> > > > > of my birth that differs
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   not from the stalling of an ox?
> > > > > His horses are bred
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   better, for, besides that they
> are
> > > > > fair with their feeding,
> > > > >class="ln
> > > > > tln">15they are taught their man�ge, and to that end riders
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   dearly hired; but I, his
> brother,
> > > > > gain nothing under
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   him but growth, for the which
> his
> > > > > animals on his
> > > > >class="ln
> > > > > tln">
> > > > >  
> > > > >   dunghills are as much bound to
> him
> > > > > as I. Besides this nothing
> > > > >class="ln
> > > > > tln">
>

[jQuery] Re: need some help with selecting text nodes

2008-05-05 Thread darren

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:






...


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:
>
> > 
> >   
> >   Some text
> >   
> >   some more text
> >   
> >   even more text
> > 
>
> > 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=
> > > > 
> > > >   
> > > >  
> > > >   As I remember, Adam, it was upon
> > > > this fashion
> > > >   5bequeathed me by will but poor a thousand
> > > >   
> > > >  
> > > >   crowns, and, as thou say'st,
> > > > charged my brother,
> > > >   
> > > >  
> > > >   on his blessing, to breed me well;
> > > > and
> > > >   
> > > >  
> > > >   there begins my sadness. My
> > > > brother Jaques he keeps
> > > >   
> > > >  
> > > >   at school, and report speaks
> > > > goldenly of his profit.
> > > >   10For my part, he keeps me rustically at home, or, to
> > > > speak
> > > >   
> > > >  
> > > >   more properly, stays me here at
> > > > home unkept; for call
> > > >   
> > > >  
> > > >   you that "keeping" for a gentleman
> > > > of my birth that differs
> > > >   
> > > >  
> > > >   not from the stalling of an ox?
> > > > His horses are bred
> > > >   
> > > >  
> > > >   better, for, besides that they are
> > > > fair with their feeding,
> > > >   15they are taught their man�ge, and to that end riders
> > > >   
> > > >  
> > > >   dearly hired; but I, his brother,
> > > > gain nothing under
> > > >   
> > > >  
> > > >   him but growth, for the which his
> > > > animals on his
> > > >   
> > > >  
> > > >   dunghills are as much bound to him
> > > > as I. Besides this nothing
> > > >   
> > > >  
> > > >   that he so plentifully gives me,
> > > > the something that
> > > >   20nature gave me his countenance seems to take from
> > > >   
> > > >  
> > > >   me. He lets me feed with his
> > > > hinds, bars me the
> > > >   
> > > >  
> > > >   place of a brother, and as much as
> > > > in him lies, mines my
> > > >   
> > > >  
> > > >   gentility with my education. This
> > > > is it, Adam, that
> > > >   
> > > >  
> > > >   grieves me; and the spirit of my
> > > > father, which I think
> > > >   25is within me, begins to mutiny against this servitude.
> > 

[jQuery] Re: need some help with selecting text nodes

2008-05-05 Thread darren

oh and yes, firebug is a Godsend. It is the most useful tool in my
programming environment, by a long shot. I strongly recommend people
learn all of its features like the debugger and the profiler.

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:
>
> > 
> >   
> >   Some text
> >   
> >   some more text
> >   
> >   even more text
> > 
>
> > 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=
> > > > 
> > > >   
> > > >  
> > > >   As I remember, Adam, it was upon
> > > > this fashion
> > > >   5bequeathed me by will but poor a thousand
> > > >   
> > > >  
> > > >   crowns, and, as thou say'st,
> > > > charged my brother,
> > > >   
> > > >  
> > > >   on his blessing, to breed me well;
> > > > and
> > > >   
> > > >  
> > > >   there begins my sadness. My
> > > > brother Jaques he keeps
> > > >   
> > > >  
> > > >   at school, and report speaks
> > > > goldenly of his profit.
> > > >   10For my part, he keeps me rustically at home, or, to
> > > > speak
> > > >   
> > > >  
> > > >   more properly, stays me here at
> > > > home unkept; for call
> > > >   
> > > >  
> > > >   you that "keeping" for a gentleman
> > > > of my birth that differs
> > > >   
> > > >  
> > > >   not from the stalling of an ox?
> > > > His horses are bred
> > > >   
> > > >  
> > > >   better, for, besides that they are
> > > > fair with their feeding,
> > > >   15they are taught their man�ge, and to that end riders
> > > >   
> > > >  
> > > >   dearly hired; but I, his brother,
> > > > gain nothing under
> > > >   
> > > >  
> > > >   him but growth, for the which his
> > > > animals on his
> > > >   
> > > >  
> > > >   dunghills are as much bound to him
> > > > as I. Besides this nothing
> > > >   
> > > >  
> > > >   that he so plentifully gives me,
> > > > the something that
> > > >   20nature gave me his countenance seems to take from
> > > >   
> > > >  
> > > >   me. He lets me feed with his
> > > > hinds, bars me the
> > > >   
> > > >  
> > > >   place of a brother, and as much as
> > > > in him lies, mines my
> > > >   
> > > >  
> > > >   gentility with my education. This
> > > > is it, Adam, that
> > > >   
> > > >  
> > > >   grieves me; and the spirit of my
> > > > father, which I think
> > > >   25is within me, begins to mutiny against this servitude.
> > > >   
> > > >  
> > > >   I will no longer endure it, though
> > > > yet I know no wise
> > 

[jQuery] Re: need some help with selecting text nodes

2008-05-05 Thread Glen Lipka
$("#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:
>
> 
>   
>   Some text
>   
>   some more text
>   
>   even more text
> 
>
> 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=
> > > 
> > >   
> > >  
> > >   As I remember, Adam, it was upon
> > > this fashion
> > >   5bequeathed me by will but poor a thousand
> > >   
> > >  
> > >   crowns, and, as thou say'st,
> > > charged my brother,
> > >   
> > >  
> > >   on his blessing, to breed me well;
> > > and
> > >   
> > >  
> > >   there begins my sadness. My
> > > brother Jaques he keeps
> > >   
> > >  
> > >   at school, and report speaks
> > > goldenly of his profit.
> > >   10For my part, he keeps me rustically at home, or, to
> > > speak
> > >   
> > >  
> > >   more properly, stays me here at
> > > home unkept; for call
> > >   
> > >  
> > >   you that "keeping" for a gentleman
> > > of my birth that differs
> > >   
> > >  
> > >   not from the stalling of an ox?
> > > His horses are bred
> > >   
> > >  
> > >   better, for, besides that they are
> > > fair with their feeding,
> > >   15they are taught their man�ge, and to that end riders
> > >   
> > >  
> > >   dearly hired; but I, his brother,
> > > gain nothing under
> > >   
> > >  
> > >   him but growth, for the which his
> > > animals on his
> > >   
> > >  
> > >   dunghills are as much bound to him
> > > as I. Besides this nothing
> > >   
> > >  
> > >   that he so plentifully gives me,
> > > the something that
> > >   20nature gave me his countenance seems to take from
> > >   
> > >  
> > >   me. He lets me feed with his
> > > hinds, bars me the
> > >   
> > >  
> > >   place of a brother, and as much as
> > > in him lies, mines my
> > >   
> > >  
> > >   gentility with my education. This
> > > is it, Adam, that
> > >   
> > >  
> > >   grieves me; and the spirit of my
> > > father, which I think
> > >   25is within me, begins to mutiny against this servitude.
> > >   
> > >  
> > >   I will no longer endure it, though
> > > yet I know no wise
> > >   
> > >  
> > >   remedy how to avoid it.
> > >   
> > >
> > > 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
> > > tr

[jQuery] Re: need some help with selecting text nodes

2008-05-05 Thread darren

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:


   
   Some text
   
   some more text
   
   even more text


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=
> > 
> >   
> >  
> >   As I remember, Adam, it was upon
> > this fashion
> >   5bequeathed me by will but poor a thousand
> >   
> >  
> >   crowns, and, as thou say'st,
> > charged my brother,
> >   
> >  
> >   on his blessing, to breed me well;
> > and
> >   
> >  
> >   there begins my sadness. My
> > brother Jaques he keeps
> >   
> >  
> >   at school, and report speaks
> > goldenly of his profit.
> >   10For my part, he keeps me rustically at home, or, to
> > speak
> >   
> >  
> >   more properly, stays me here at
> > home unkept; for call
> >   
> >  
> >   you that "keeping" for a gentleman
> > of my birth that differs
> >   
> >  
> >   not from the stalling of an ox?
> > His horses are bred
> >   
> >  
> >   better, for, besides that they are
> > fair with their feeding,
> >   15they are taught their man�ge, and to that end riders
> >   
> >  
> >   dearly hired; but I, his brother,
> > gain nothing under
> >   
> >  
> >   him but growth, for the which his
> > animals on his
> >   
> >  
> >   dunghills are as much bound to him
> > as I. Besides this nothing
> >   
> >  
> >   that he so plentifully gives me,
> > the something that
> >   20nature gave me his countenance seems to take from
> >   
> >  
> >   me. He lets me feed with his
> > hinds, bars me the
> >   
> >  
> >   place of a brother, and as much as
> > in him lies, mines my
> >   
> >  
> >   gentility with my education. This
> > is it, Adam, that
> >   
> >  
> >   grieves me; and the spirit of my
> > father, which I think
> >   25is within me, begins to mutiny against this servitude.
> >   
> >  
> >   I will no longer endure it, though
> > yet I know no wise
> >   
> >  
> >   remedy how to avoid it.
> >   
> >
> > 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.


[jQuery] Re: need some help with selecting text nodes

2008-05-05 Thread Joe


$("#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=
> 
>   
>  
>   As I remember, Adam, it was upon
> this fashion
>   5bequeathed me by will but poor a thousand
>   
>  
>   crowns, and, as thou say'st,
> charged my brother,
>   
>  
>   on his blessing, to breed me well;
> and
>   
>  
>   there begins my sadness. My
> brother Jaques he keeps
>   
>  
>   at school, and report speaks
> goldenly of his profit.
>   10For my part, he keeps me rustically at home, or, to
> speak
>   
>  
>   more properly, stays me here at
> home unkept; for call
>   
>  
>   you that "keeping" for a gentleman
> of my birth that differs
>   
>  
>   not from the stalling of an ox?
> His horses are bred
>   
>  
>   better, for, besides that they are
> fair with their feeding,
>   15they are taught their man�ge, and to that end riders
>   
>  
>   dearly hired; but I, his brother,
> gain nothing under
>   
>  
>   him but growth, for the which his
> animals on his
>   
>  
>   dunghills are as much bound to him
> as I. Besides this nothing
>   
>  
>   that he so plentifully gives me,
> the something that
>   20nature gave me his countenance seems to take from
>   
>  
>   me. He lets me feed with his
> hinds, bars me the
>   
>  
>   place of a brother, and as much as
> in him lies, mines my
>   
>  
>   gentility with my education. This
> is it, Adam, that
>   
>  
>   grieves me; and the spirit of my
> father, which I think
>   25is within me, begins to mutiny against this servitude.
>   
>  
>   I will no longer endure it, though
> yet I know no wise
>   
>  
>   remedy how to avoid it.
>   
>
> 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.