spread html in multiple lines javascript

前端 未结 4 1681
轻奢々
轻奢々 2021-02-05 21:09

I want to put the below html code in my javascript function. I don\'t want to put it all next to each other. Is it possible to the code in the same way as how it is in html? Cod

4条回答
  •  遥遥无期
    2021-02-05 21:29

    Updated, seems like Javascript does support multi lines by adding a backslash ( \ ) as the last character in the line, you can't even have a space bar behind it, because then it won't cancel the line break.

        var str = '';
    

    Or use a HTML template and load it into a DIV (using jQuery)

    $("#div").load("/html_template.html");
    

提交回复
热议问题