Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
89
rated 0 times [  92] [ 3]  / answers: 1 / hits: 15814  / 14 Years ago, wed, june 30, 2010, 12:00:00

I have a textarea and I want to replace n with , in it's value.



var valuetxtarr = $(#txtarr).val();
var valuetxtarrs = valuetxtarr.replace(/n/g,,);
alert(valuetxtarrs);


But it don't work?Why?Where I have mistake?


More From » jquery

 Answers
8

You just need to remove the quotes (otherwise it's looking for that string), like this:



var valuetxtarr = $(#txtarr).val();
var valuetxtarrs = valuetxtarr.replace(/n/g,,);
alert(valuetxtarrs);​


You can give it a try here


[#96374] Saturday, June 26, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jadyngraysons

Total Points: 455
Total Questions: 109
Total Answers: 98

Location: Trinidad and Tobago
Member since Fri, May 8, 2020
4 Years ago
jadyngraysons questions
Thu, Apr 23, 20, 00:00, 4 Years ago
Sat, Jan 18, 20, 00:00, 4 Years ago
Tue, Dec 31, 19, 00:00, 4 Years ago
;