Why doesn't javascript newlines work inside html?

后端 未结 13 2586
梦谈多话
梦谈多话 2020-12-06 12:08

So I have the following:


  
    
  
<         


        
13条回答
  •  無奈伤痛
    2020-12-06 12:59

    Everyone has said what it was to be said but in case if you are using firebug/chrome Javascript console ..then try this >

    console.log("Hello\nWorld");

    This is the key difference. When you are printing something in HTML, the HTML rules apply. Elsewhere you can see the line breaks work.

提交回复
热议问题