You can specify a multi-line string in JavaScript, but it will be ugly. For instance:
// This has 3 lines var s = "abc\n" + "def\n" + "ghi";
An alternative solution is to put the multi-line string in hidden HTML code and then extract it using jQuery in the DOM:
<pre id="my-art" style="display:none">here is my multi-line ascii art snowman or other graphic</pre> $(document).ready(function(){ $("button").click(function(){ $("input:text").val( $("#my-art").text() ); }); });
source share