var e = document.getElementById(this.htmlFor);
case "radio": e.checked|=1;break;
case "checkbox": e.checked=!e.checked;break;
case "text": case "password": case "textarea": e.focus(); break;

This adds the onclick event to the LABEL itself, which seems to work very well in IE.

Chris Altman said on August 24, 2006

AWESOME Code! Thank you

Riddle said on October 09, 2006

Hi, I came up with CSS workaround for this bug - you can watch the demo because frankly, I don't think you understand Polish. ;-)

Best regards.

Tuning Marc said on October 17, 2006

Nice trick, seems to work very well in IE7.

Porter said on December 18, 2006

Many thanks! My need for an IE fix is very specific so I just use addEvent in-page, but this helped me confirm it wasn't my HTML or some other specific conflict, just another IE wonkyism.

Krishna said on January 17, 2007

You have done a good job. I am facing this problem and I got solution by this. So I am thankful to you. So keep doing such work.

Pete Graham said on April 16, 2007

Excellent solution, thanks a lot!

Yuri Teixeira said on May 21, 2007

I liked it... But it needs a little modification to fire onclick events of a checkbox, select, or text input. Here is my patched version of this script snipt that need to be modified:

switch (e.type) {
   case "radio":; break;
   case "checkbox":; break;
   case "text": case "password": case "textarea": e.focus(); break;

Best Regards

Conradson said on February 11, 2011

The Prototype solution :

Event.observe(window, 'load', function() {
if (Prototype.Browser.IE) {
var imgLabels = $$("label img");
imgLabels.each(function(eachImgLabel) {
Event.observe(eachImgLabel, "click", function() {
var radiolabel = eachImgLabel.ancestors()[0].readAttribute('for');

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.