Posted By

daisuke103 on 04/21/09


Tagged

javascript js textmate strip br nl


Versions (?)

JS 改行コードをに置き換える


 / Published in: Other
 

  1. $("textarea").change( function() {
  2. var txtVal = $(this).val();
  3. txtVal = txtVal.replace(/rn/g, "&lt;br /&gt;<br />");
  4. txtVal = txtVal.replace(/(n|r)/g, "&lt;br /&gt;<br />");
  5. $('#testpre').html('<p>'+ txtVal +'</p>');
  6. });

Report this snippet  

You need to login to post a comment.