0
注意事項:
我沒有訪問
jQuery是包含在HTML引擎(由發動機渲染)(這就是爲什麼我不包括在我的代碼)得到一個類型錯誤功能不存在錯誤
此代碼需要一個鏈接並將其注入到HTML:從代碼
$(document).ready(function(){
addSS('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
addScript('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js');
addScript('//InjectedHTML.js');
});
function addScript(str){
var script = document.createElement('script');
script.src = str;
document.head.appendChild(script);
};
function addSS(str){
var link = document.createElement('link');
link.rel= 'stylesheet';
link.href = str;
link.type= 'text/css';
document.head.appendChild(link);
};
InjectedHTML把日期選擇到HTML(在一個單獨的文件上面):
$(document).ready(function() {
addClass(); //adds class attribute to an input that allows me to use datepicker function
datePicker(); //adds calendar
});
function addClass(){
$("#DateWrapper input").attr("class", "datepicker");
};
function datePicker(){
$(".datepicker").datepicker();
};
收到此錯誤:
InjectedHTML.js:35遺漏的類型錯誤:$(...)日期選擇器是不是一個函數
感謝您的幫助!
這可能會幫助你:http://stackoverflow.com/quest離子/ 14328762/jquery-ui-loaded-event –
檢查你的js路徑是否正確 –
JS路徑是正確的。 – juice