I'm having trouble with a relatively simple piece of code here. I'm trying to delay removeAttr
for 5 seconds after a checkbox is clicked, using change()
.
I can get the removeAttr
to work instantly on change, or the setTimeout
to work on page load, but not in combination of the two.
<input type="checkbox" id="human"> I am a human
<input type="file" disabled name="file" id="file" />
$('document').ready(function(){
$('#human').change(
setTimeout(function(){
$('#file').removeAttr("disabled");
}, 5000));
});
Here is a complimentary JSFiddle of my issue.
Thanks guys and girls.