Sunday, March 31, 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

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...