How to use Twitter Bootstrap popovers for jQuery validation notifications?

后端 未结 16 1696
无人共我
无人共我 2020-11-30 16:49

I can make popovers appear using bootstrap easily enough, and I can also do validations using the standard jQuery validation plugin or the jQuery validation engine, but I ca

16条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 17:12

    This is what I put in my validate to conform to the Twitter Bootstrap guidelines. The error validation message is put in a and we want to highlight the outer container as an error or success:

    errorClass:'help-inline',
    errorElement:'span',
    highlight: function (element, errorClass, validClass) {
    $(element).parents("div.clearfix").addClass('error').removeClass('success');
    },
    unhighlight: function (element, errorClass, validClass) {
    $(element).parents(".error").removeClass('error').addClass('success');
    }
    

提交回复
热议问题