chhaya_patel chhaya_patel - 1 month ago 7
HTML Question

Stop Checkbox click form other function

I want to stop click event of checkbox on this below button's function call

//Checkbox
<label id="lblsetrefmodule" for="chksetreflayout" class="lbl-disable">
<input id="chksetreflayout" class="data_checkbox" onchange="RefLayoutDisplay();" type="checkbox" style="display:none; margin-right: 8px;" disabled="disabled">Set Reference Module Layout
</label>
//Button
<div class="detail-view" id="detail-view-id"><a id="detailview" onclick="get_fields('DetailView')">Detail View</a></div>

get_fields(name){
//I want to stop checkbox click for full execution of this function
code
//enable that click
}

Answer

You can disable the checkbox while the function executed

get_fields(name){
    document.getElementById("chksetreflayout").disabled = true;
    code
    document.getElementById("chksetreflayout").disabled = false;
 }
Comments