lundi 12 mai 2014

How to fire an event only when text is entered in an input box but not removed?


Vote count:

0




The following code snippet triggers an alert event when a number is entered (or removed from) into a 9 * 9 Sudoku grid.



$('table tr td input').on({"input": function () {
var cell = $(this).val();

if (!$.isNumeric(cell)) {
alert("Please enter only numbers from 1 to 9");
}

}});


But how to remove the alert message when text is removed. It has to be triggered only when number is entered. Thanks in advance.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire