tags:

views:

109

answers:

3

I have the following line of code:

<li>
    <label for="q2-1" onclick="setActive(this.id, 'question2-1-input');" id="q2-1-label"><input disabled="disabled" type="checkbox" name="question2" id="question2-1-input" value="1" />Opinions</label>
</li>

which calls:

function setActive(questionID, questionIDinput) 
{
    alert('setActive');
}

The above code works great in FF & Safari but not in IE. Is something above not IE friendly?

Thanks

+1  A: 

I believe that you should put the onclick even on the input instead of the label.

Guffa
it is perfectly fine to have an onclick for the label.http://www.w3schools.com/tags/tag_label.asp
DmitryK
A: 

You should have the onclick event on the checkbox, not the label, the onclick event will be fired because you have the for="q2-1" on the label

John Boker
+3  A: 

Do not use "setActive". It is already taken (name of an existing function). Replace it with something else (setActive1() will do ;) ) and it will start working in IE as well.

DmitryK
That was it, thanks. I also noticed that LABEL had the INPUT wrapped inside which is sloppy, but that wasn't the cause.Bad: <label><input></input></label>Good: <label></label><input></input>
AnApprentice