Disable 'Add' button if checkbox is checked
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I'm assuming you're trying to enable/disable only the button related to the checkbox : $('.is-selected').on('change', function () {
$(this).closest('label').next('.remove-attr').prop('disabled', this.checked);
});
|
Enable Disable Button if any of checkbox is checked
Date : March 29 2020, 07:55 AM
wish of those help I have Check All and Check Non Section. , Try $('.check:button').click(function () {
var checked = !$(this).data('checked');
$('input:checkbox').prop('checked', checked);
$('.delete:button').prop('disabled', !checked)
$(this).data('checked', checked);
if (checked == true) {
$(this).val('Uncheck All');
} else if (checked == false) {
$(this).val('Check All');
}
});
$('input:checkbox').change(function () {
$('.delete:button').prop('disabled', $('input:checkbox:checked').length == 0)
})
$('.delete:button').click(function () {
var array = $('input:checkbox:checked').map(function () {
return this.value
}).get();
console.log(array, array.join())
})
|
How can I disable a button until a checkbox is checked?
Date : March 29 2020, 07:55 AM
Does that help I would like to have a form button disabled, until a user clicks a checkbox. , Your logic is a little off, try this: $('#check').change(function () {
$('#btncheck').prop("disabled", !this.checked);
}).change()
|
How do I check whether a user has 'checked' the checkbox & enable the submit button if checked else disable?
Tag : html , By : mlapida
Date : March 29 2020, 07:55 AM
wish of those help @GünterZöchbauer's answer is almost correct. This is a solution you could use. <input type="checkbox" #checkbox (change)="angular = checkbox.checked">
<button type="submit" [disabled]="!checkbox.checked ? true : null">
<input type="checkbox" [(ngModel)]="object.selected" />
|
Disable Button if checkbox is not checked
Date : March 29 2020, 07:55 AM
wish helps you I have the below table structure generated from a rest call within it are input checkboxes, before the table is created there a static buttons that I want to disable unless any of the checkboxes are clicked , Here you go with a solution $('#GetItems tbody').html(`<tr style="background-color: rgb(204, 204, 204);">
<td style="width: 349px;"><strong>Select</strong>
<input name="chk" type="checkbox" value="35">
</td>
<td style="width: 211px;"> </td>
<td style="width: 396px;"><strong>Requester: </strong>Test user</td>
<td style="width: 149.2px;"><strong>Raised Date:</strong> 29/11/2017</td>
<td style="width: 806.8px;" colspan="3"> </td></tr><tr>
<td style="width: 349px;"><strong>Item Requested For:<br>:</strong>Desktops</td>
<td style="width: 211px;"><strong>Bomb<br> </strong>ITSS</td>
<td style="width: 396px;"><strong>Department:</strong><br>ITSS Infrastructure</td>
<td style="width: 149.2px;"><strong>Job Title:</strong><br>Consultant</td>
<td style="width: 376.8px;"><strong>Phone Number:</strong><br>032394</td>
<td style="width: 213px;"><strong>Request Type</strong><br>:New Allocation</td>
<td style="width: 217px;"><strong>Replacement Type:<br></strong>New Allocation</td>
</tr>`);
$('#GetItems').on('change', 'input[name=chk]', function(){
if($(this).is(':checked')) {
$('#Reject').removeAttr('disabled');
$('#Approve').removeAttr('disabled');
} else {
$('#Reject').attr('disabled', true);
$('#Approve').attr('disabled', true);
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="divbuttons">
<button id="Reject" type="button" disabled>Reject</button>
<button id="Approve" type="button" disabled>Approve</button>
</div>
<table id="GetItems" cellspacing="12">
<tbody>
</tbody>
</table>
|