I have a simple Javascript that gets an element by ID and inserts a text with a break line tag using the innerHTML method. The page is in XHTML 1.0 so I am using <br />
.
var dom = document.getElementById(elmt);
var message = "This is a test";
dom.innerHTML = message + "<br />";
I have tested in Chrome and in IE and they both change the tag to <br>
.
I am performing some .search with <br />
, but it fails because it is not including the forward slash.
Is there a reason for this? How can I force it to send <br />
?
"` and `"
"` and they both print `
` – Rick Oct 11 '14 at 02:22
) – Tasos Oct 11 '14 at 02:22
. See [here](http://i.imgur.com/4zR7FuZ.png). – Rick Oct 11 '14 at 02:27
tag has no end tag. In XHTML, the
tag must be properly closed, like this:
. so in html (/) gets stripped off – Tasos Oct 11 '14 at 02:28