Just remove them if you need:

$('span').text().replace('\n', '');

- ricardo

On Feb 26, 10:12 am, AdrenalineJunkie <jason.h...@gmail.com> wrote:
> Im building a form parser(plugin) that will build a json object to a specific
> design.  One problem I am having involves how I render some html and
> subsequently read that html.  I am new to jQuery so please forgive me if I
> am missing something simple.  
>
> Consider the following snippet
> &lt;span&gt;some text&lt;/span&gt;
> jQuery('span').text() yields 'some text' which is what I expect.
>
> now consider this html snippet
> &lt;span&gt;some text
> &lt;/span&gt;
> jQuery('span').text() yields 'some text\n' which is the source of my
> problems with the json2 parser.
>
> My question is:
> Is there another (best practice) way to get the text from the span (or other
> tags) without the source line breaks?
>
> --
> View this message in 
> context:http://www.nabble.com/Issue-with-.text%28%29-and-line-breaks-tp222237...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to