簡體   English   中英

使用jQuery刪除元素上的驗證器

[英]removing validators on an element using jquery

我有下面的html向下鑽取控件,它在運行時生成..並且我想禁用所有的驗證。

 <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>

但是當我單擊提交按鈕時,它仍然會在此向下鑽取中觸發驗證。我嘗試了下面的代碼不起作用。我需要禁用其他任何內容。

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

我是那樣做的

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

我會嘗試這樣的:

$('#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");
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM