jQuery UI没有完全使用DatePicker

时间:2016-06-21 10:18:32

标签: jquery jquery-ui datepicker

https://jqueryui.com/datepicker/

enter image description here

jQuery UI datepicker如上所示,但我的版本如下所示。 enter image description here

我的jQuery文件是

enter image description here

public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        /*"~/Scripts/jquery-{version}.js",*/
                        "~/Scripts/jquery-1.12.4.min.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        //"~/Scripts/jquery-ui-{version}.js",
                       // "~/Scripts/jquery-ui-*",

                        "~/Scripts/jquery.switchButton.js",
                        "~/Scripts/jquery-ui.min.js"
                        ));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            bundles.Add(new ScriptBundle("~/bundles/dataTables").Include(
                        "~/Scripts/media/js/jquery.dataTables.js"));

            bundles.Add(new ScriptBundle("~/bundles/moment").Include(
                        "~/Scripts/moment.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));
        }
    }
}

我添加了jQuery和jQuery UI的最新稳定版本,并更改​​了bundle配置以避免重复错误(这是我必须从Uncaught TypeError: undefined is not a function in datepicker开始)

enter image description here

一个StackOverflow回答说,moment.js应该高于jQuery UI,但我没有发现任何变化,现在我完全难过,因为之前看不到jQuery UI部分工作。请帮忙!

1 个答案:

答案 0 :(得分:2)

答案很简单..您尚未添加对jquery-ui.css的引用。它只是工作正常但styles/CSS未应用。

通过 this answer

中提到的链接获取相应版本的CSS