Discuss the problem of js creating checkbox by default in ie
- 2020-03-26 21:34:04
- OfStack
Test browsers: ie8(compatibility and incompatibility modes), ff6.
The above code does not always work in ie8 compatible mode and ff6, but it does not work in ie8 incompatible mode. Only after appendChild, the checked value is set will all work, as follows:
That seems to be the opposite.
var chk = document.createElement("input");
chk.setAttribute("type","checkbox");
container.appendChild(chk);
chk.setAttribute("checked",true);
The above code does not always work in ie8 compatible mode and ff6, but it does not work in ie8 incompatible mode. Only after appendChild, the checked value is set will all work, as follows:
var chk = document.createElement("input");
chk.setAttribute("type","checkbox");
chk.setAttribute("checked",true);
container.appendChild(chk);
That seems to be the opposite.