Reputation: 4632
I want to lock my input files from editing by user while I'm submitting my files in a chain (through wrappers and callbacks).
Although it was easy to lock my form just by adding readonly attributes to the input elements:
$('form input').attr('readonly','readonly');
It just doesn't work on input files.
The disabled
attribute kinda works, but it wouldn't submit the file then...
So, any ideas how to lock it?
Upvotes: 1
Views: 676
Reputation: 1
or you can try this:
$('input[type=file]').click(function(){
$(this).attr('disabled', 'disabled');
});
Upvotes: -2
Reputation: 144669
You can use the preventDefault()
method of the event
object, try the following:
$('input[type=file]').click(function(e){
e.preventDefault()
})
Upvotes: 4