我正在尝试使用 JQuery 从 html 页面获取类列表。我正在使用以下代码:
$('.questionsOnPage').each(function () {
item = {}
var id = this.id;
....
这适用于所有浏览器,但不适用于 IE 10(我没有尝试过旧版浏览器)但在 IE 中 this.id 为 null。
html 看起来像这样:
<div value="23" class="questionsOnPage"><input id="23" class="questionCheckBox" type="checkbox" />
...
<div value="24" class="questionsOnPage"><input id="24" class="questionCheckBox" type="checkbox" />
...
如果可以的话请帮忙
最佳答案
This works in all browsers but not IE 10
这不是真的。它不适用于任何其他浏览器。
.questionsOnPage
是 div,没有 id
。
ID 位于 .questionCheckBox
为什么要在 div 中放置 value
属性?这是没有意义的,把它放在 input
元素中。
关于javascript - Jquery 不返回数据 IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21177264/