Javascript examples for jQuery:String
Storing text area input with \n value in string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript"> $(window).load(function(){/*www .jav a2 s . c om*/ $("textarea").keydown(function(){ $('#txt').html($("textarea").val().replace(/\r?\n/g,"\\n")); }).keyup(function(){$("textarea").keydown()}); }); </script> </head> <body> <textarea></textarea> <div id="txt"></div> </body> </html>