Javascript - Script to remove special chars except space, Accept space and not other special chars

Script to remove special chars except space

Remove all non alphabets or special characters except space from a string using javascript. Some times we might have a need to accept only space in a text box, while we a name or college details in to the text box. In such conditions you can use below script as example one.

<script type="text/javascript">
 var myval = "lover's Guide lesson#s";
 alert(myval.replace(/[^a-zA-Z ]/g, ""));
</script> 

The topic on Javascript - Script to remove special chars except space is posted by - Math

Hope you have enjoyed, Javascript - Script to remove special chars except spaceThanks for your time

Tech Bluff