Sunday 31 March 2019

javascript - Adding Keypress/keydown event on dynamic html

I have the following dynamic input html in my project




  $(this).html("");


Now i was trying to add validation for using only numeric in above input text field.



But being new to jquery i was wondering how do i add keypress event to it



Want to use following validation to it



function isNumber(evt) {

evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}


I tried follwoing but does not seem to work




$(this).html("");


EDIT



Any other way to add validation for using only number

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...