0

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

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

I doubt it works in other browsers. I think you want to do something like

$('.questionsOnPage input').each(function () {
    item = {}
    var id = $(this).id;
    ....

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.