-1
次のコードには、教育とmoraleducation.iのコードが含まれています。ボタンをクリックすると教育と道徳教育の両方のフィールドを検証します。jsを使用してフィールドの教育とmoraleducationを検証する方法
$('body').on('change', '#education', function(){
if(!$("#education").val()) {
$(this).closest('.form-group').addClass('has-error');
}else{
$(this).closest('.form-group').removeClass('has-error');
}
});
$('body').on('click', '#update', function(){
if(!$("#education").val()) {
$(this).closest('.form-group').addClass('has-error');
}else{
$(this).closest('.form-group').removeClass('has-error');
}
});
$('body').on('change', '#moraleducation', function(){
if(!$("#moraleducation").val()) {
$(this).closest('.form-group').addClass('has-error');
}else{
$(this).closest('.form-group').removeClass('has-error');
}
});
$('body').on('click', '#update', function(){
if(!$("#moraleducation").val()) {
$(this).closest('.form-group').addClass('has-error');
}else{
$(this).closest('.form-group').removeClass('has-error');
}
});