Saturday, 15 June 2013

javascript - jQuery - how to append values into html elements without getting them parsed as html tags -


Yes the question sounds strange, but what do I want to achieve when I

. The html () function I want some parts , such as

.text () function. For example, in this undesirable

  $ ("# htmltest"). Html ("& lt; ul> gt; 
  • " + ** unexpected (testvar) ** + "<+

    To behave, + Unsecope (Escape (TestWire) + requires I & lt; / ul & gt; That means HTML tags should be treated as text It should not be parsed. This is a generic

  • > example Please provide a general solution that can be used for all tags like
    tag & lt; ta Ble tag Is html html html html html html html is any tag in html which can give the browser instructions to parse that text? ?

    You can use element to set markup, then in that container You can insert the text and apply it on.

    In your case, something like this:

      $ ("# htmltest"). Html (" & Lt; ul> gt; Le & gt; & Lt; / Li & gt; & Lt; / Ul & gt; ") appears (" le ") text (testvar).    

    No comments:

    Post a Comment