How to use jQuery Validate form validation with dropkick select elements (DIV based select form element)

前端 未结 3 473
攒了一身酷
攒了一身酷 2021-01-22 00:05

I want to use jQuery validate library on a div based select form element. I am using the dropkick library to beautify my selects, but I am having difficulties trying to validate

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-22 00:47

    highlight and unhighlight function might help :)

    $('.default').dropkick();
    $('.example_form').validate({
        highlight: function (element, errorClass) {         
        $(element).siblings('.dk_container').addClass('error');  
        $('.dk_toggle').css('border', 'none');
        },
        unhighlight: function(element, errorClass) {
        $(element).siblings('.dk_container').removeClass('error');  
        $('.dk_toggle').css('border', '1px solid #ccc');
        }
    });
    

    http://jsfiddle.net/jackoverflow/82XvN/

提交回复
热议问题