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

jQuery clickable div with working mailto link inside -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -