How to Disable My Toggle Button? This Is My Code
I Want to Disable My Input Button. 4 1 Answer If You Want to Disable the Button by Default Then If You Want to Disable Button on Some Action in Jquery...
<label class="switch switch-yes-no" id="check_'+id+'" style="margin: 0;font-weight: bold;">
<input class="switch-input" type="checkbox" id="check_'+id+'" />
<span class="switch-label" data-on="Published" data-off="Hidden"> </span>
<span class="switch-handle"></span>
</label>
I want to disable my input button.
1 Answer
If you want to disable the button by default then
<input class="switch-input" type="checkbox" id="check_'+id+'" disabled/>
If you want to disable button on some action in jquery
$(function(){
$('#SomeButton').on('click', function(){
$('#your_input_id').attr('disabled' , 'disabled') //OR
$('#your_input_id').prop('disabled' , true) //true for disabled, false to enable
});
});
Or, if you want to disabled by default on page load WITHOUT any action
$(function(){
$('#your_input_id').attr('disabled' , 'disabled') //OR
$('#your_input_id').prop('disabled' , true) //true for disabled, false to enable
});