javascript regex to replace special chars and allow space
I have the following JS function:
 
    function noSpecialChars(element) {
    	element.value = element.value.replace(/[^a-z\u00D1\u00F10-9]*/ig,'').toUpperCase();
    }

That i apply to a input text, but it doesn't allow spaces on the word typed.

Would it be better to write a function that instead of replacing the special chars, one that only allowed letters a-z, numbers 0-9 and space?

I'm new to javascript and regex.
javascript regex to replace special chars and allow space
===

I have the following JS function:
 
    function noSpecialChars(element) {
    	element.value = element.value.replace(/[^a-z\u00D1\u00F10-9]*/ig,'').toUpperCase();
    }

That i apply to a input text, but it doesn't allow spaces on the word typed.

Would it be better to write a function that instead of replacing the special chars, one that only allowed letters a-z, numbers 0-9 and space?

I'm new to javascript and regex.