Treehouse: Grow your CSS skills. Land your dream job.

in jquery html()

  • # January 9, 2012 at 5:09 pm

    I’m accessing a webservice to get the content to my website page and that content have some

    Instead of making a new line, html() function is printing <br /> in the middle of the string.
    Is there any other function to deal with html tags like it should?

    # January 10, 2012 at 12:33 am

    I’m not really sure what you mean. Could you explain a bit more clearly?

    # January 10, 2012 at 7:09 am

    I believe what he is saying is that he’s getting some content from an external webservice and it contains html elements.

    However, when outputting the content to the page using $(element).html(content); the html elements are outputted as is, instead of actually putting a line break in the content.

    Am I right?

    # January 10, 2012 at 9:32 am

    That’s right. Sorry for the bad explanation, my English didn’t allowed a better one. :)

    I tried $(element).text(content) too but the output is:

    bla bla<br />bla bla

    My file is encoded with utf-8 and when I make the request I’m using:

    req.setRequestHeader("Content-Type", "text/xml;charset=utf-8");

    Any idea?

    # January 25, 2012 at 2:13 am

    Hmmm, why don’t you try using jQuery to get the requests?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.