如何使用selected.js应用jQuery验证引擎?

时间:2016-07-15 07:34:04

标签: jquery jquery-chosen jquery-validation-engine

我尝试运行作者的代码,使selected.js与jquery验证引擎一起工作

Here 是作者代码

我使用相同的代码进行测试,但它无法正常工作

这是我的代码

jQuery(document).ready(function() {
                // binds form submission and fields to the validation engine
                jQuery("#formID").validationEngine({
                    prettySelect : true,
                    useSuffix: "_chzn"
                    //promptPosition : "bottomLeft"
        });
        $("#country").chosen({
                    allow_single_deselect : true
        });
});

Here 是我的小提琴

我不知道我的代码中有什么问题?

1 个答案:

答案 0 :(得分:2)

回答我自己的问题

我通过将“_ chzn”更改为“_ selected”来解决问题。还添加 validateNonVisibleFields = true ,因为chosen select隐藏了actual select

jQuery('#formID').validationEngine({
           validateNonVisibleFields: true, 
           prettySelect : true,
           useSuffix: "_chosen"
  });