0

I want to disable the input file property with Javascript so that it couldn't browse the file. Please help.

Found this but it is in Jquery

$('#images').prop('disabled', true);
cenica
  • 5
  • 2
  • Like any type of input or button, a file input has a `disabled` property that you can simply assign to `true` or `false` with an `=` operator. – Peterrabbit Nov 05 '22 at 07:12

1 Answers1

-1

Access the HTML disabled attribute then set it to true, you can try with

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

For more information, https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/disabled

  • I have different question can I ask here please? – cenica Nov 05 '22 at 07:30
  • @cenica no please ask a new question instead – Ethan Nov 07 '22 at 17:53
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Ethan Nov 07 '22 at 17:53