入力テキストと入力チェックボックスの検証にこのコードを使用します。しかし、必要な関数に選択ボックスの検証を追加したい。ユーザーが1つの文字列を選択し、ボックスの塗りつぶしを選択する必要があります。
required:{
set:function(val) {
//Check the type of the input
switch(this.tagName) {
case 'INPUT':
if($(this).attr('type') == 'text') {
val = $.trim(val);
if(val === '') {
return false;
}else {
return true;
}
}else if($(this).attr('type') == 'checkbox') {
return $(this).is(':checked') ? true : false;
}
break;
default:
return false;
break;
}
},
message:'This field is required.'
},
しかし、何をどこにコードを追加するのかわかりません。