JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td>Input 1</td>
<td><input type="text" name="q1" id="q1" /></td>
</tr>
<tr>
<td>Input 2</td>
<td><input type="text" name="q2" id="q2" /></td>
</tr>
<tr>
<td>Input 3</td>
<td><input type="text" name="q3" id="q3" /></td>
</tr>
<tr>
<td>Input 4</td>
<td><input type="text" name="q4" id="q4" /></td>
</tr>
</table>
JavaScript
$(document).ready(function() {
// put all your jQuery goodness in here.
/*$(":input").keydown(function(event) {
// Allow only backspace and delete
if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 ) {
// let it happen, don't do anything
}
else {
// Ensure that it is a number and stop the keypress
if (event.keyCode < 48 || event.keyCode > 57 ) {
event.preventDefault();
}
}
});*/
$(":input").focusout(function(){
var $this = $(this),
input = $this.val();
if (input > 10){
alert('You must enter a number between 0 and 10');
setTimeout(function(){
$this.focus();
}, 1);
}
});
});