0

I have a html input field like this:

<input name="files[]" id="files" type="file" style="display: none;" onchange="saveFile();" multiple="true" />

How can i change multiple's value to false using javascript?

1
  • 1
    Where is your code? You have tried something on your own? Commented Aug 29, 2013 at 10:33

2 Answers 2

2

Try using .setAttribute()

Syntax: element.setAttribute(attributename,attributevalue)

Your code should look like this

document.getElementById("files").setAttribute("multiple","false");
Sign up to request clarification or add additional context in comments.

1 Comment

Actually i tried that before, but it didn't work because the problem was elsewhere in the code. Anyway, thanks for the help.
0

The jquery way for this would be

 $('input:file[name="some_name"]').attr('multiple', 'false');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.