本文介绍了在加载jquery ui日期选择器的同时,还要使用自举库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩bootstrap,我要添加一个datepicker到页面使用它,但没有任何成功..所以我找到一个datepicker的代码,使用查询ui:



在新的html页面中尝试过,它的工作方式就像一个魅力。然而,我现在想在我正在开发的页面中使用这个,但是似乎在不同的脚本和css文件之间有一些冲突。有办法解决这个问题吗?



(我已经删除了页面的内容,但遗漏了我正在导入的脚本和链接)

 <!DOCTYPE html> 
< html>
< head>
< meta charset =utf-8>
< meta name =viewportcontent =width = device-width,initial-scale = 1.0>
< title> Svensk Bridge< / title>
< link rel =stylesheettype =text / csshref =../ css / bootstrap.css>
< link rel =stylesheettype =text / csshref =../ css / bootstrap-responsive.css>
< / head>

< body>

< p>日期:< input type =textid =datepicker/>< / p>


< script type =text / javascriptsrc =../ js / jquery.js>< / script>
< script type =text / javascriptsrc =../ js / bootstrap.js>< / script>
< script type =text / javascriptsrc =../ js / list-function.js>< / script>
< / body>
< / html>

如果我要导入jquery ui的日期选择器的所有文件,它不会工作。

 < html lang =en> 
< head>
< meta charset =utf-8/>
< title> jQuery UI Datepicker - 默认功能< / title>
< link rel =stylesheethref =http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css/>
< script src =http://code.jquery.com/jquery-1.9.1.js>< / script>
< script src =http://code.jquery.com/ui/1.10.2/jquery-ui.js>< / script>
< link rel =stylesheethref =/ resources / demos / style.css/>
< script>
$(function(){
$(#datepicker).datepicker();
});
< / script>
< / head>
< body>

< p>日期:< input type =textid =datepicker/>< / p>


< / body>
< / html>

所以,总结一下:我可以在我现有的文档中实现jquery ui datepicker吗?哪些脚本和链接被优先考虑?



Regards,
Bill

解决方案

我正在使用引导使用Jquery UI datepicker,问题必须是您导入的顺序。
这里我的订单:

 < script type =text / javascriptsrc =js / jquery-1.8 .3.js>< / script> 
< script type =text / javascriptsrc =js / jquery-ui-1.10.2.custom.js>< / script>
< script type =text / javascriptsrc =js / bootstrap.js>< / script>
< link type =text / csshref =css / jquery-ui-1.10.2.custom.css =stylesheet/>
< link type =text / csshref =css / bootstrap.css =stylesheet/>


I'm playing around with bootstrap and i was going to add a datepicker to the page using it, but without any success.. So i found the code for a datepicker, using query ui: Datepicker

And tried this in a new html page, and it worked like a charm. However, i now want to use this in the page i was working on, but it seems like there are some conflicts between the different scripts and css files. Is there a way to solve this?

(i have delated the content of the page but left the scripts and links i'm importing)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Svensk Bridge</title>
        <link rel="stylesheet" type="text/css" href="../css/bootstrap.css">
        <link rel="stylesheet" type="text/css" href="../css/bootstrap-responsive.css">
    </head>

    <body>

        <p>Date: <input type="text" id="datepicker" /></p>


        <script type="text/javascript" src="../js/jquery.js"></script>
        <script type="text/javascript" src="../js/bootstrap.js"></script>
        <script type="text/javascript" src="../js/list-function.js"></script>
    </body>
</html>

If i were to import all the files for the jquery ui for the date picker, it won't work.

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker" /></p>


</body>
</html>

So, to sum up: Can i implement the jquery ui datepicker into my already existing document? And which scripts and links get prioritized?

Regards,Bill

解决方案

I am using Bootstrap with Jquery UI datepicker, the problem must be the order in which you import things.Here my order:

<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.2.custom.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<link type="text/css" href="css/jquery-ui-1.10.2.custom.css" rel="stylesheet" />
<link type="text/css" href="css/bootstrap.css" rel="stylesheet" />

这篇关于在加载jquery ui日期选择器的同时,还要使用自举库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 12:21