You can use the jQuery paste event on any textbox/editor as shown below. It is supported by all modern browsers.
Following example shows handling numeric values on key press and past.
<script type="text/javascript">
function pageLoad() {
Following example shows handling numeric values on key press and past.
<script type="text/javascript">
function pageLoad() {
$("#controlID").on('paste, keydown', function e() { return isNumericKey(e); });
}
function isNumericKey(e) {
var charInp = window.event.keyCode;
if (charInp > 31 && (charInp < 48 || charInp > 57)) {
return false;
}
return true;
}
</script
>
Cheers,
Samitha
No comments:
Post a Comment