I muck written j Query accreditation for a Liaison form. 我写了一部简单的法典,将检查输入表是否含有任何特性;如果具有任何特性,它可能继续管理购买力平价代码,并寄给我电子邮件。 否则,就会发现一个错误的盒子,告诉客户要进行双重检查。 该守则是:
(function($){
$( .required ,$form).each(function(){
var inputVal = $( form-element-name ).val();
var inputVal2 = $( form-element-email ).val();
if(inputVal == ){
$( errorbox1 ).addClass( errormsg1 );
}
else if(inputVal2 == ) {
$( errorbox2 ).addclass( errormsg2 );
}
}
}
Inputval is the inputfield for the name and inputval2 is the inputfield for the e-mail. Furthermore, Errorbox1 is a container that is empty and the errormsg1 would be the class that would give the errorbox1 a background-image saying error.