admin管理员组文章数量:1334691
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.
本文标签: javascriptHow to detect browser supports this HTML5 featureStack Overflow
版权声明:本文标题:javascript - How to detect browser supports this HTML5 feature - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742377723a2463498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论