Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
109
rated 0 times [  115] [ 6]  / answers: 1 / hits: 19413  / 13 Years ago, wed, february 15, 2012, 12:00:00

I have the following JQuery AJAX call that sends HTML form data to my server side script to deal with. However I currently find line breaks and convert them to <br /> for display in another part of my application. I now need to make sure I am stripping out apostrophes however I am not confident on how to replace multiple characters in one go.



This is the JQuery I use currently before adding this into my AJAX.



description = $(#description).val().replace(/n/g, '<br />');


Can anyone point me in the right direction?



Thanks


More From » jquery

 Answers
7

You don't have to do it in one go in the sense of one call to .replace(), just chain multiple .replace() calls:



description = $(#description).val().replace(/n/g, '<br />')
.replace(/'/g, '');


(Or replace with '&#39;' or '&apos;' if that's what you need...)


[#87451] Tuesday, February 14, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
annie

Total Points: 483
Total Questions: 97
Total Answers: 107

Location: Belarus
Member since Sat, Jul 18, 2020
4 Years ago
;