javascript - Replacing Characters other than numbers in textbox -


i want allow numbers(1 5), $(dollar) .(decimal) , '(singlequote) in textbox. want on keyup event. if user types other these character, should replaced *. please tell how can it?

you can strip string on key-up this:

$('input[type=text]').keyup(function(){   $(this).val($(this).val().replace(/[^1-5$.']/g, '*')); }); 

keep in mind should verify on server side (there plethora of ways around on client side).


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -