Reputation: 1
I have input area where I want to replace inputted single quote ' to another character instantly. Something like this but for single quote only:
!(/^[A-zÑñ0-9]*$/i).test(f.value)?f.value = f.value.replace(/[^A-zÑñ0-9]/ig,''):null;
Any help appreciated.
Upvotes: 0
Views: 42
Reputation: 1772
It can be easily achieved by using replace
function. In case you want to replace all instances of the single quote with uppercase x use
f.value = f.value.replace(/'/g, 'X')
You can refer to docs for further details.
Upvotes: 1