$("p").contents();
I would prefer the useage of this like the following:
$("p").each(function() {
console.log( $(this).contents()[0] );
// with plain javascript:
console.log( this.firstChild );
});
On 28 Sep., 21:56, MorningZ <morni...@gmail.com> wrote:
> that wouldn't remove the span,as the expression $(txt) creates a new
> and not-on-the-DOM object, removing the span would do so just from the
> jQuery object
>
> On Sep 28, 3:51 pm, pedram...@gmail.com wrote:
>
> > Dear MorningZ ,
> > I don't want to remove the Span I just want to filter the text before
> > the Span ...
> > Pedram
>
> > On Sep 28, 10:22 pm, MorningZ <morni...@gmail.com> wrote:
>
> > > this is TOTALLY untested, but should work
> > > $("p").click(function() {
> > > var txt =$(this).html();
> > > txt = $(txt).find("span").remove().text();
> > > alert(txt);
> > > );
>
> > > On Sep 28, 2:13 pm, pedram...@gmail.com wrote:
>
> > > > Hi Guys,
>
> > > > this is the Code which I am working on
>
> > > > <p>
> > > > Data which I need to select and it hasn't an attribute
> > > > <span> Data in a Span </span>
> > > > </p>
> > > > <p>
> > > > Data which I need to select and it hasn't an attribute
> > > > <span> Data in a Span </span>
> > > > </p>
> > > > <p>
> > > > Data which I need to select and it hasn't an attribute
> > > > <span> Data in a Span </span>
> > > > </p>
> > > > How could FIlter and Select the text Before the <span>
> > > > does someone has an Idea ?
>
>
No comments:
Post a Comment