Remove all occurrences of a char from a string

Using Jquery Regular expression & function replace() we can remove all occurrences of a char from a string .
I am writing below single line code to do this .

I am taking an example to remove any char from any text field .

$(‘#fieldid’).val($(‘#fieldid’).val().replace(/\anychar/g,’ ‘));

/g will remove all occurrences of that char otherwise first occurance will remove only .

Show Buttons
Hide Buttons