I have seen similar questions but either I am not understanding the answers or they don't address my question so please bare with me.
我见过类似的问题,但要么我不理解答案,要么他们没有解决我的问题,所以请光临我。
I have a jQuery date picker install on several of my web pages using MVC. As such type="date" is added to the control.
我使用MVC在我的几个网页上安装了一个jQuery日期选择器。因此,type =“date”被添加到控件中。
1) If using IE11 or less the jQuery control shows correctly. 2) If using Firefox 42 the jQuery control shows correctly. 3) If using MS-Edge I get the Edge date picker plus the jQuery date picker. 4) If using Chrome I get both date pickers. 5) If using Safari (Windows) I get something, I am not sure what it is. 6) Some mobile device do a combination of the above.
1)如果使用IE11或更低版本,则jQuery控件正确显示。 2)如果使用Firefox 42,则jQuery控件正确显示。 3)如果使用MS-Edge,我会获得边缘日期选择器和jQuery日期选择器。 4)如果使用Chrome,我会同时获得两个日期选择器。 5)如果使用Safari(Windows)我得到了一些东西,我不确定它是什么。 6)一些移动设备做上述的组合。
So where I agree with the general consensus that browser select is wrong and really don't want to guess on which browsers support what, I do need a solution.
所以,如果我同意浏览器选择错误的一般共识,并且真的不想猜测哪些浏览器支持什么,我需要一个解决方案。
Is there a way to determine if the browser has it's own date picker?
有没有办法确定浏览器是否有自己的日期选择器?
Basically I want to turn off the jquery datepicker if the browser supports it and turn it on if it does not.
基本上我想关闭jquery datepicker如果浏览器支持它,如果不支持则打开它。
The other thing I was thinking was to add a date picker button so the user can either use the default if it works on click the button if they want or need the jQuery date picker. This way at least the two options are not competing.
我想的另一件事是添加日期选择器按钮,以便用户可以使用默认值,如果它可以工作,如果他们想要或需要jQuery日期选择器,请单击按钮。这样至少这两个选项不会竞争。
Suggestion?
建议?
1 个解决方案
#1
1
As Tamil Selvan pointed out in his comment.
This is how I got it to work.
泰米尔塞尔万在评论中指出。这就是我开始工作的方式。
if (!Modernizr.inputtypes.date)
{
$("input[type=date]").datepicker();
}
#1
1
As Tamil Selvan pointed out in his comment.
This is how I got it to work.
泰米尔塞尔万在评论中指出。这就是我开始工作的方式。
if (!Modernizr.inputtypes.date)
{
$("input[type=date]").datepicker();
}