178
rated 0 times
[
181]
[
3]
/ answers: 1 / hits: 28728
/ 10 Years ago, fri, july 18, 2014, 12:00:00
I have multiple checkboxes and a file upload input. I would like to re-enable a button if one or more checkbox's are checked AND if the input value is not null.
Here is a link to bootply
Here my html
<div class=upload-block>
<input type=checkbox>
<input type=checkbox>
<input type=checkbox>
<input type=file id=InputFile>
<button id=upload-btn type=button blue-button
class=btn blue-button disabled>Submit</button>
</div>
Here is my javascript starting point:
Updated via Karl
Bind a change
event on all input and then use some condition:
$('.upload-block input').change(function() {
$('#upload-btn').prop(
'disabled',
!($('.upload-block :checked').length && $('#InputFile').val()));
});
This works for all the checkboxes and #InputFile
has a value other than none. i.e. where a file has been chosen. However this does not work in IE9
How can I update this to work in IE9?
More From » jquery