Created
July 12, 2022 02:20
-
-
Save nian88/371f4bfd62e5520df1fcb7748987b93e to your computer and use it in GitHub Desktop.
memfilter inputan pada text html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).ready(function() { | |
$('.noSymbol').keypress(function (e) { | |
var txt = String.fromCharCode(e.which); | |
if (!txt.match(/[A-Za-z0-9&.]/)) { | |
return false; | |
} | |
}); | |
$('.numberOnly').keypress(function (e) { | |
var txt = String.fromCharCode(e.which); | |
if (!txt.match(/[0-9.]/)) { | |
return false; | |
} | |
}); | |
$('.numberOnly').focusout(function (e) { | |
var el = this; | |
if (!el.value >0) { | |
el.value =''; | |
} | |
}); | |
$('.numberOnly').focusin(function (e) { | |
var el = this; | |
if (el.value ==0) { | |
el.value =''; | |
} | |
}); | |
$('.numberOnly').bind('paste', function() { | |
var el = this; | |
setTimeout(function() { | |
el.value = el.value.replace(/\D/g, ''); | |
}, 0); | |
}); | |
$('.aphaOnly').keypress(function (e) { | |
var txt = String.fromCharCode(e.which); | |
if (!txt.match(/[A-Za-z. ]/)) { | |
return false; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment