问题
I have a piece of code here which is working fine in FireFox, Chrome and InternetExplorer 9 but is not working in the InternetExplorer 8. I'm dealing with select boxes.
var finalExclusionList = Dom.get("finalExclusionList-box");
var countryList = Dom.get("regionsAndCountries-box");
for (var i=0; i<finalExclusionList.length; i++) {
countryList.add(finalExclusionList[i]);
}
I'm having error in the countryList.add method, is saying Invalid Argument ...
Does anyone knows what can be the error in IE8 ?
IE8 - CONSOLE.LOG
console.log(countryList)
LOG: [object HTMLSelectElement]
console.log(countryList[0])
LOG: [object HTMLOptionElement]
console.log(finalExclusionList[i])
LOG: [object HTMLOptionElement]
console.log(countryList.add)
LOG:
function add() {
[native code]
}
IE9 - CONSOLE.LOG
>> console.log(countryList)
LOG: [object HTMLSelectElement]
>> console.log(countryList[0])
LOG: [object HTMLOptionElement]
>> console.log(finalExclusionList[i])
LOG: [object HTMLOptionElement]
>> console.log(countryList.add)
LOG:
function add() {
[native code]
}
Thank you !
回答1:
countryList.add()
? I would use countryList.appendChild()
.
来源:https://stackoverflow.com/questions/11231543/javascript-error-in-add-method-using-ie8