该集合尚未初始化。 [英] The collection has not been initialized.
本文介绍了该集合尚未初始化。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在尝试删除onclick时出现此错误,因此它不会在每次单击按钮时创建双重元素。
多次单击按钮时可以正常工作但是在狂野之后我得到这个错误:
I get this error, when trying to remove onclick so it wont create double element on every button click.
It works when clicking on the button many times but after a wild i get this error:
Line: 2
Error: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
这里是我的代码< br $>
here is my code
$(function () {$("#dialog").dialog({
autoOpen: false
});
var node = document.createTextNode("Lediga tider att boka");
var para = document.createElement("p");
var selectList = document.createElement("select");
var element = document.getElementById("textresultfree");
while (element.hasChildNodes()) {
element.removeChild(element.firstChild);
}
var myDiv = document.getElementById("myDivResult");
while (myDiv.hasChildNodes()) {
myDiv.removeChild(myDiv.firstChild);
}
para.appendChild(node);
element.appendChild(para);
myDiv.appendChild(selectList);
$("#dialog").dialog("open");
var free = "";
for (var j = 0; j < bookedFreeTimes.length; j++) {
free = bookedFreeTimes[j];
var array = new Array(free);
for (var k = 0; k < array.length; k++) {
var option = document.createElement("option");
option.text = array[k];
selectList.appendChild(option);
}
}
}
);
}
推荐答案
( function ( ){
( #dialog)。dialog( {
autoOpen: false
});
var node = document .createTextNode( Lediga tider att boka);
var para = document .createElement( p);
var selectList = document .createElement( 选择);
var element = document .getElementById( textresultfree) ;
while (element.hasChildNodes()){
element.removeChild(element.firstChild);
}
var myDiv = document .getElementById( myDivResult);
while (myDiv.hasChildNodes()){
myDiv.removeChild(myDiv.firstChild);
}
para.appendChild(node);
element.appendChild(para);
myDiv.appendChild(selectList);
("#dialog").dialog({ autoOpen: false }); var node = document.createTextNode("Lediga tider att boka"); var para = document.createElement("p"); var selectList = document.createElement("select"); var element = document.getElementById("textresultfree"); while (element.hasChildNodes()) { element.removeChild(element.firstChild); } var myDiv = document.getElementById("myDivResult"); while (myDiv.hasChildNodes()) { myDiv.removeChild(myDiv.firstChild); } para.appendChild(node); element.appendChild(para); myDiv.appendChild(selectList);
( #dialog )。dialog( open);
var free = ;
for ( var j = 0 ; j< bookedFreeTimes.length; j ++){
free = bookedFreeTimes [j];
var array = new 数组(免费);
for ( var k = 0 ; k< array.length; k ++){
var option = document .createElement( option);
option.text = array [k];
selectList.appendChild(option);
}
}
}
);
}
("#dialog").dialog("open"); var free = ""; for (var j = 0; j < bookedFreeTimes.length; j++) { free = bookedFreeTimes[j]; var array = new Array(free); for (var k = 0; k < array.length; k++) { var option = document.createElement("option"); option.text = array[k]; selectList.appendChild(option); } } } ); }
这篇关于该集合尚未初始化。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文