Firefox输入标签和jquery 1.9

时间:2013-07-17 14:50:54

标签: javascript jquery firefox input label

我试图弄清楚在不使用.browser的情况下检测firefox的最佳方法是什么(因为jquery 1.9已经弃用了它)

基本上我有这个HTML:

<label class="uploadButton" for="test">Test</label>
<input type="file" name="test"/>

这适用于IE和Chrome,但在Firefox中没有任何作用。 Pre 1.9我有这个:

if ($.browser.mozilla) {
    $('.uploadButton').click(function () {
        $(this).siblings("input").click();
    });
}

哪个没有问题。

现在,.browser属性消失后,最好的方法是什么?

(我查看了功能,发现没有能够检测到类似内容的功能......)

1 个答案:

答案 0 :(得分:0)

我找到了

ua = window.navigator.userAgent.toLowerCase()

作为答案的一部分here