I have a form which is laid out like a spreadsheet.
I want to validate the text in each textbox and if it\'s not numeric, change the background of the textbox and di
Got this working for me! :) references
Loop through all text boxes in a form using jQuery & https://stackoverflow.com/a/311589
$(document).ready(function() {
$('form button[type=submit]').click(function() {
// attach the listener to your button
debugger;
var sub_form = $(this.form);
// use the native JS object with "this"
$(':input[class="required"]', sub_form).each(function() {
if (this.value == "") {
alert("is empty");
} else {
alert(this.value);
}
});
});
});
body {
margin: 5px;
padding: 5px;
border: 1px solid black;
}
#topContainer {
width: auto;
margin: 2px;
padding: 2px;
border: 1px solid black;
height: 100px;
}
#mainContainer {
width: auto;
height: 200px;
margin: 2px;
padding: 2px;
border: 1px solid black;
}
#footerContainer {
width: auto;
height: 200px;
margin: 2px;
padding: 2px;
border: 1px solid black;
}
.gridRow4 {
margin: 2px 5px;
width: 25%;
}
.gridRow5 {
margin: 2px 5px;
width: ;
}
text goes here