Revision: 47986
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 21, 2011 09:00 by reverend
Initial Code
function checkForm(){
//get the form input
$("input#firstn").blur(function(){
var thecheckvar = $(this).val();
if (thecheckvar.length < 2 ){
//alert("the first name is: "+firstName+" and is too short!");
$("#fname_e").show();
$("input#firstn").css('background-color', 'red');
$("input#submitbutton").hide();
} else {
//alert("Ok, your good to go!");
$("#fname_e").hide();
$("input#firstn").css('background-color', '#f5d286');
}
});
$("input#lastn").blur(function(){
var thecheckvar = $(this).val();
if (thecheckvar.length < 4 ){
$("#lname_e").show();
$("input#lastn").css('background-color', 'red');
$("input#submitbutton").hide();
} else {
//alert("Ok, your good to go!");
$("#lname_e").hide();
$("input#lastn").css('background-color', '#f5d286');
}
});
$("textarea#address").blur(function(){
var thecheckvar = $(this).val();
if (thecheckvar.length < 20 ){
$("#address_e").show(400);
$("textarea#address").css('background-color', 'red');
$("input#submitbutton").hide(400);
} else {
//alert("Ok, your good to go!");
$("#address_e").hide(400);
$("textarea#address").css('background-color', '#f5d286');
}
});
$("input#theemail").blur(function(){
var thecheckvar = $(this).val();
if (thecheckvar.length < 8 ){
$("#email_e").show();
$("input#theemail").css('background-color', 'red');
$("input#submitbutton").hide();
} else {
//alert("Ok, your good to go!");
$("#email_e").hide();
$("input#theemail").css('background-color', '#f5d286');
}
});
Initial URL
Initial Description
Initial Title
Simple Validation of form fields
Initial Tags
simple, jquery, validation
Initial Language
jQuery