Currently I need to validate every form like this:
$(document).ready(function () {
$('#admin_settings_general').validate({
rules: {
admin_settings_application_title: {
required: true
}
},
highlight: function (element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function (element) {
$(element).closest('.form-group').removeClass('has-error');
}
});
});
I want that it automaticly validate the forms for every element with the required
tag.
How can I do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…