I want to detect (using javascript/jQuery) whether the user's browser supports multiple
attribute to input type='file'
tag. A feature of HTML5 to add multiple images.
<input type=file name="images" value=" " multiple=""/>
Please suggest me how can i do this.
I want to detect (using javascript/jQuery) whether the user's browser supports multiple
attribute to input type='file'
tag. A feature of HTML5 to add multiple images.
<input type=file name="images" value=" " multiple=""/>
Please suggest me how can i do this.
Share Improve this question asked May 5, 2012 at 13:19 Rusi NovaRusi Nova 2,6656 gold badges35 silver badges48 bronze badges5 Answers
Reset to default 6var i = document.createElement("input");
if (typeof i.multiple !== 'undefined') {
// supports multiple
}
you can use modernizr
which is developed for this purpose.
http://modernizr./
you can detect support of a feature like placeholder
in this way:
if (!Modernizr.input.placeholder) {
}
As taken & edited from the Modernizr source:
var inputElem = document.createElement('input');
var multipleSupport = !!(multiple in inputElem);
You don't need to include a plete library if this is the only thing you need.
I suggest you use Modernizr javascript library? This provides a way to check if browsers support various features.
You can use Modernizr, which does a huge number of these tests for you.
In this case, though, the test is really easy:
if (typeof document.createElement('input').multiple !== "undefined") {
// ... yes, it has it
}
The same is true of all the other new properties on elements.