Reputation: 339
I need to remove tab characters within text inputted into particular fields of a web interface. The problem seems to be that when this happens the resulting text now contains spaces where the tabs were.
I tried using the regex : vVal = vVal.replace(/(\s+)/, "");
but using the example input 11111[tab]
, the value becomes 11111[space]
.
I dont know how this could be..
Upvotes: 5
Views: 14276
Reputation: 785691
\s
matches any whitespace that includes space also.
For tab try \t
with global switch:
vVal = vVal.replace(/\t+/g, "");
Upvotes: 10