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);
1
  • 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. Commented Nov 5, 2022 at 7:12

1 Answer 1

-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

Sign up to request clarification or add additional context in comments.

3 Comments

I have different question can I ask here please?
@cenica no please ask a new question instead
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.