2014-04-25 20 views
2

夥計們,我在我的表單中的datepicker的應用程序標題中包含了兩個腳本標記。當我包含這些標籤datepicker功能正常工作,但css響應不工作。但是,當我刪除這些腳本,然後響應CSS工作正常,但日期選擇器功能停止working.Here下面的腳本標籤爲Jquery庫在rails中無法正常工作4

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> 
<script src="//code.jquery.com/jquery-1.10.2.js"></script> 
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> 

當我刪除這些標籤然後日期選擇壓延不會出現,但是當我刪除這些響應隨後優良工程。對於響應我有使用兩個庫如下所示

<link href="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js" rel="javascript" type= "text/js"> 
<link href="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" rel="javascript" type= "text/js"> 

請提出我該怎麼做。我使用rails 4.任何幫助將不勝感激。謝謝

回答

1

儘量不要同時包含jQuery和jQuery。只選一個。

或者(首選):

<script src="//code.jquery.com/jquery-1.10.2.js"></script> 

或者:

<link href="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" rel="javascript" type= "text/js"> 

看它是否解決您的問題。我不確定,但包含兩個jQuery庫可能是衝突。

0

您必須使用正確的軌道標籤:

在你application.html.erb:

<%= javascript_include_tag :application %> 

在你的application.js:

//= require jquery 
//= require jquery_ujs 
//= require other_libraries 

嘗試使用這樣的寶石解決你的問題:

Boostrap Datepicker Rails