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