Input:
"I want to remove double space from textbox."
Output:
"I want to remove double space from textbox."
function valid(f) {
return f.replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ');
}
I have called this event onblur="valid(this);"
You need to be accessing the value of the input… in your above code you’re trying to run a regex on an input object.