Reputation: 11
How do you write in JavaScript "<br>"
? I don't want it to break and go to the next line, I just want the html tag to be written. Something like: "the break tag in html is ..."
Example of what I want below.
<script type = "text/javascript">
document.write('"<br>"');
</script>
Upvotes: 1
Views: 1631
Reputation: 67505
You could use HTML entities of <
and >
:
< : <
> : >
<br> = <br>
Hoep this helps.
document.write("I don't want <br> to break and go to the next line");
Upvotes: 0
Reputation: 386570
Just use HTML entities.
Character Entity Note --------- ------- ---------------------------------------------------------------- & & Character indicates the beginning of an entity. < < Character indicates the beginning of a tag > > Character indicates the ending of a tag " "e; Character indicates the beginning and end of an attribute value.
document.write('The break tag in html is <br>.');
Upvotes: 2