javascript - How to allow certain characters in input field -


how can allow "a-za-z0-9 &#$._-" along "/" . tried jquery

$('.allow').bind('keyup blur',function(){      $(this).val( $(this).val().replace(/[^a-za-z0-9 &#$._-]/g,' ') ); }  ); 

along need allow forward slash "/".

can please me out. great help.

use ^ , $ outside of []. match allowed characters.

you need escape / , - in regex

/^[a-z0-9 &#$._\-\/]$/i 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -