That still seems to only return an object rather than a string. This
works though...

alert($('div').clone().children().remove().end().text());

Is there a better way to get a string than that?



On May 2, 6:28 pm, mkmanning <michaell...@gmail.com> wrote:
> Don't use .text(), you'll get an array-like object of text nodes. Try
>
> var text = $('div').contents().filter(function(){return
> this.nodeType==3;});
> console.log(text)
>
> On May 2, 6:06 pm, nick <nboutel...@gmail.com> wrote:
>
>
>
> > Thanks for the response. Are you sure thats correct though?
>
> > alert($('div').contents().filter(function(){return
> > this.nodeType==3;}).text());
>
> > returns empty.- Hide quoted text -
>
> - Show quoted text -

Reply via email to