html - jQuery appending multiple line string -


i'm trying append string html element. works fine when it's 1 line string, when try break apart stops working.

  <div><h4 >list do:</h4><span id="added"></span></div> 

this doesn't work:

  var addtext = "<ol>                  <li>item1</li>                  <li>item2</li>                  </ol>"                    $("span#added").html(addtext); 

can make work. want add lot of html code, , i'd readable?

try :

var addtext = "<ol>\                  <li>item1</li>\                  <li>item2</li>\                  </ol>"; 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -