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
Post a Comment