jquery form-validator logic 失效?

$.validate({

lang : 'zh',

modules : 'logic'

});

<input

type="checkBox" id="enableFlag" name="validation-flag"

<c:if test="${portalServer.enable==1}">checked="checked"</c:if> />

<input type="text" data-validation="required"  

data-validation-depends-on="validation-flag" />

我想实现checked下验证,没有选中不验证

照着官网来的,复选框并没有起作用,求教

版本

/** File generated by Grunt -- do not modify

 *  JQUERY-FORM-VALIDATOR

 *

 *  @version 2.3.41

 *  @website http://formvalidator.net/

 *  @author Victor Jonsson, http://victorjonsson.se

 *  @license MIT

 */

/**

 * Deprecated functions and attributes

 * @todo: Remove in release of 3.0

 */

github地址

xx001
浏览 1027回答 1
1回答

慕瓜9220888

DVKKJZHBLYXWVBFJDZXCBJVTXXECQTZVFTKLHPLRQAHIRVXGPSPMDHKFUDXEVTGDHQMMSZHULDCOLIMDTJXTLQOBICLNQHKFWKLPLCCPWUIMRQTHEBJXLKNNWIZIMWKVNENIWYWWRKZCTPZQACEEHVFJUZUAZPCYMMITGIIVTAELDJDJARBDIMXTZWHRBOZEEDATDDYDMBHSZMNGRUMZZQHBDYVVRBFTQLUEUGKKOWHJYRWALBIKRXXTANLEVAZLHRXYZJPRBXDBOIPASVOFZTNHSONNOGXBGEGZWGGRRZUJVUVCOFBJCYDQRVPRMBEGEIFZATNNULZECSEUAOCDHVXVZNXSKHMQFREECWMKJIUBEJHDBINDNDRZQBZERIIGRFTCSZFFNBFNIGIFZAIDOFHBJTRFQYNLZGXPYDLBGCGQXTAGGFVFVPHJJCIZJPBIGRNMIKEBQUSPVEOIGRQBAFPZWBVUKSARKRSWKCKTELIAPZRCQTHDLMUSUTDGARCBFTOAJZTHEDGRRWCNDHYUVLXDWABRVWCBKBPZQVLIHTEVIPUOBHIZGGHQLKAGHLSIBWLRHHAKCRZFQTZDBLPQWPWUULVWUQFBVLFPGBNZSIDXEKVHHQKRBIMUTPYTTAUFQJVBSUUJXSYRQROPMSQWFVLFLZEPXGMMTALXCVXDDXMTRVBXQZGGBWESBUMXQYITQTDXYDULHNQABFYDFQFBEOPDLWUCYLBTUJFXHTKUMHVRMGZWHVGFCHHRRVWAIGPLIYOPEGMRHKDLVGNSHBWCGYWECAKHRCNVKJMSSSTCQEBDDTIPKIDEGNNKWRCKIOUKXLQRMBJTCDSQIWPOOHOZWRSKZWTGRPWQIIZJVNHPNTXNJPJQQHOUGDNIGEKVJQJXLFUYDYBVVJRMAELRHXFNLWMILLZRVXYVKKKUGOWKKZPVLDRCHSXGDJXZTRPRNHXVDECGBBRSNIGOTYFVJYTBSNCFFIDLZEFKXAUVTEOOAJJKZBCDPORUOVLGXMYMZJEECNRQDVLJXSWZNNNEBWUFZVYHEPXVZRWWSFQYGNZFZWJHPUVVHNRRPKIBNSQDUYWNSASWZSELGRWTQQGKSQUIKRRHLQOCRMMCZHXLJWIVFVTACJUTJJXIKLMSHTDGHSZNXSZISGEMKLQWTMUVQYRGZTJUPONXWCGQEVWROJDGXLDEJJGQQGHELNXQJTPBVWLZKHNDOICWIWWZZBSKOTHUARIAQHTCFLSDOMELQTQDEXVTZYCGMXLDEPUHNDYJCQZIRILFKPZUJJTWCUSANYMZMUTLZBXVLSRTXIUZMMFRYTYMVFFXVFHVQRCPSDUIXVRRZJHYQIXMMSIDRJNNMIOIGONWIHXHKITACKQAHBIDFTAIYKDVTXFEQJWCOVNEHKHKARMKYGOBYLWHIDSHRJZRUFKLDEKKVDBMZKAAPWOWUPSOILMKNLCAHFFJHWUHMJTTAPWUWBORNYDTRNJJTZXBQEQZPCMKMAPZEXAYJEFJQVPIJHEQENCYLHMAZJEDGWZUSGRGBXUKIGYAAPCTJOFARSEAAXVJAGKQDWDLZHRMUOOMHMTOMRRJWNHCGZORYHCRJUINQPBFQISAJMMXIGYJ

彼岸誰在

这是我做过的复选框的代码,你试一下。在复选框的表单中记得onClick="checkAll()"//验证全选 function checkAll(){ var select1=document.getElementById("all").checked; var select2= document.getElementsByName("enjoy"); for(var i=0;i<select2.length;i++){ select2[i].checked=select1; } }//再次验证function boxEvents(){ var inputs=document.getElementsByName("enjoy"); for(var i=0;i<inputs.length;i++){ if(inputs[i].type="checkbox"){ inputs[i].onclick = boxOnBlur;// 不写括号,注册函数 } } }   function boxOnBlur(){ var inputs=document.getElementsByName("enjoy"); var num=0; for(var i=0;i<inputs.length;i++){ if(inputs[i].type="checkbox"){   var rag=inputs[i].checked;    if(!rag){ document.getElementById("all").checked=false;     num++; } } if(num<=0){      document.getElementById("all").checked=true;   } }   }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery