Javascript examples for jQuery Method and Property:val
Converting Escaped Literals to Specials with JavaScript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> <script type="text/javascript"> $(window).load(function(){/* w w w .j av a 2s .co m*/ var str = 'aaasddd this is a test asdf'; console.log( str.replace('s',$('#my').val().replace(/\\n/g,'\n')) ); }); </script> </head> <body> <input id="my" value="\n"> </body> </html>