Datepicker Multiple Dates not working in Google Apps Script

白昼怎懂夜的黑 提交于 2019-12-12 04:39:21

问题


I am trying to create a datepicker that allows users to select multiple dates. These are the javascript and stylesheet references I am using:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://multidatespickr.sourceforge.net/jquery-ui.multidatespicker.js"></script>

<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />

This is the function I am calling once the document is ready:

try{
  $("#recievedInHouseDate").multiDatesPicker();
}catch(e){
  alert(e)
};

And the alert I get is: TypeError: $(...).multiDatesPicker is not a function

Any idea why this wouldn't work. I can get the regular date picker working fine if I only want to select a single date.


回答1:


Why do you import jquery-ui twice?

here:

script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js">/script

and here:

script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">/script

I think you should remove one of them. At least in my case that caused a similar to yours problem with Datepicker.




回答2:


Try this line to avoid any conflict while loading jQuery libraries

jQuery.noConflict(); 


来源:https://stackoverflow.com/questions/34904225/datepicker-multiple-dates-not-working-in-google-apps-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!