简体   繁体   中英

removing validators on an element using jquery

I have the below html drill down control which is generated at run time..And i want to disable all the validations on it.

 <label class="mark" for="SupportTo_L1" id="SupportTo_L1_Label">select a value&nbsp;</label>

 <select aria-labelledby="SupportTo_L1_Label SupportTo_L1_Error" aria-required="true" 
         class="op-combobox" data-ishorizontal="true" data-drilldowntype="true"
         data-register-change-event="true" data-val="true"
         data-val-required="<img class='validateicon'              
         src='https://sxsvc.supp.maro.com/PAdvy0.0.0/Content/Images/16x16-red-alert.png'/><font color='Red'>*</font> Required"
         id="SupportTo_L1"
         name="SupportTo_L1" title="Technology group involved in the project:">

<button class="submitbutton" id="submit" name="submit" type="submit" 
        value="submit">Submit</button>

But still it fires a validation on the this drill down when i clicked on the submit button.I tried the below code which didn't work.Anything else i need to disable.

$('#SupportTo_L1').attr(
     {'data-val':'false','aria-required':'false'}
    );

我是那样做的

document.getElementById("elemenId").required = false;

I would try this:

$('#SupportTo_L1').removeAttr('data-val');
$('#SupportTo_L1').removeAttr('aria-required');
$("#submit").click (function (e) {
e.preventDefault();
$("select.op-combobox").attr("data-val","false");
$("select.op-combobox").attr("aria-required","false");
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM