L
lihao0129
Hi, folks:
I recently went through a strange problem with my Javascript code,
say: I have a string variable which are from a 'textarea' element and
I want to remove the trailing newlines inside the string. I am using
something like the following:
var txt = textarea_element.value.replace(/\n*$/, '');
But this replaced only the last newline(by changing '' to 'K', and
alerting the response). Am I doing something wrong or is there any
better ways to remove trailing black lines with Javascript? many
thanks,
lihao(XC)
I recently went through a strange problem with my Javascript code,
say: I have a string variable which are from a 'textarea' element and
I want to remove the trailing newlines inside the string. I am using
something like the following:
var txt = textarea_element.value.replace(/\n*$/, '');
But this replaced only the last newline(by changing '' to 'K', and
alerting the response). Am I doing something wrong or is there any
better ways to remove trailing black lines with Javascript? many
thanks,
lihao(XC)