Reputation: 1331
I am trying to get a list of classes from an html page using JQuery. I am using the following code:
$('.questionsOnPage').each(function () {
item = {}
var id = this.id;
....
This works in all browsers but not IE 10 (I haven't tried older browsers) But in IE The this.id is null.
The html looks like this:
<div value="23" class="questionsOnPage"><input id="23" class="questionCheckBox" type="checkbox" />
...
<div value="24" class="questionsOnPage"><input id="24" class="questionCheckBox" type="checkbox" />
...
Please help if you can
Upvotes: 0
Views: 33
Reputation: 3754
I doubt it works in other browsers. I think you want to do something like
$('.questionsOnPage input').each(function () {
item = {}
var id = $(this).id;
....
Upvotes: 1
Reputation: 160963
This works in all browsers but not IE 10
It's not true. It will not work on any other browsers.
.questionsOnPage
is the div, with no id
.
The id is on .questionCheckBox
And why you put value
attribute in the div? It's non sense, put it in the input
element.
Upvotes: 2