I would like to have multiple lines when I use jQuery's html method, like this:
$("#someID").html(" <h1>Headline 1</h1> <h1>Headline 2</h1> ");
However this snippet of code does not work. Is there a way to use multiple lines when using jQuery's html method?
Multiline Comments You can comment multiple lines by the special beginning tag <! -- and ending tag --> placed before the first line and end of the last line as shown in the given example below.
As part of a form, the <textarea> tag creates a multiline text-entry area in the user's browser display. In it, the user may type a nearly unlimited number of lines of text.
use \
to escape new line chars.
$("#someID").html("\ <h1>Headline 1</h1>\ <h1>Headline 2</h1>\ ");
View working example here: http://jsfiddle.net/amantur/yeDff/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With