Input type file as read-only

1

I'm trying to set a read-only input file type when clicking the submit, but the form below did not work. Any suggestions?

<script>
$(document).ready(function() {
    $("#salvar").on('click', function() {
       $('#arquivo').prop('readonly', true);
    });
});
</script>
    
asked by anonymous 03.05.2016 / 20:08

2 answers

1

Change the property readonly to disabled .

<script>
$(document).ready(function() {
    $("#salvar").on('click', function() {
       $('#arquivo').prop('disabled', true);
    });
});
</script>

link

    
03.05.2016 / 20:12
1

To disable an input-file use the disabled property

JavaScript example

document.getElementById("myFile").disabled = true;

Example with jQuery

$('myFile').prop('disabled', true);
    
03.05.2016 / 20:12