Abhijat M

Abhijat M

Wednesday, 27 June 2012

ie6 Jquery Select Labels and IE6

Yes if you have to do it theres this sinppet that resolves an Ie6 bug wherein the selectLabels do not hold their values when clicked from their corresponding label.

More Here: http://support.microsoft.com/kb/314279

 function ie6(){  
  return jQuery.browser.msie && /msie 6\.0/i.test(navigator.userAgent);  
 }  
 function fixIe6SelectLabel(){  
  if(ie6()){  
   jQuery('select').bind({  
    focusin: function(event) {  
     try {  
     var eSrc = event.target;  
     if ( eSrc ) eSrc.tmpIndex = eSrc.selectedIndex;  
     } catch(e) {}  
    },  
    focus: function(event) {  
     try {  
    var eSrc = event.target;  
    if ( eSrc ) eSrc.selectedIndex = eSrc.tmpIndex;  
    } catch(e) {}  
    }  
   });  
  }  
 }