Javascript doesn't write a slash

I have the following: http://jsfiddle.net/mVs9T/13/

Can someone tell me why the output prints

<br> 

instead:

 <br/> 

like here: http://f.imgtmp.com/Xjoq3.png

+4
source share
4 answers

We added alert(txt); and he gave us <br/> - it looks good.

+1
source

Yes, since chrome interprets the <br /> tag. It is simply aesthetically pleasing; You do not need to worry about it.

+3
source

This is the behavior of the browser. This should not be a problem.

0
source

Since nothing can pass between the <br> tag, the /> part is not needed. This is probably why the browser does not display it.

0
source

Source: https://habr.com/ru/post/1413051/


All Articles