0

I am trying to implement two cascading html selects (i.e. selectedindex from the first determines the options in the second). The following code works fine in FireFox but not IE.

for (var i = 0; i < origProcDDL.length; i++) 
      {                  
          if (selectedMod != origProcDDL.options.item(i).attributes.getNamedItem('value').nodeValue)
          {                                
              origProcDDL.options.item(i).className = "hide";          
          }           
      }

  }   
  function resetProcedures()
  {
    //refresh the list
      for (i = 0; i < origProcDDL.length; i++) {                        
          origProcDDL.options.item(i).className = "";
      }                
  }
  • 1
    possible duplicate of [Styling options in bold in Internet Explorer](http://stackoverflow.com/questions/6655625/styling-options-in-bold-in-internet-explorer) – Paul Roub Nov 13 '13 at 16:00

1 Answers1

2

You can't add style to an option element on IE.

Read this: Styling options in bold in Internet Explorer

I had this problem once. My workaround was working with javascripts arrays.

Note: There is another problem with that approach. If you select (focus) the dropbox and use the keyboard to navigate, the hidden element will be shown.

Simple example to demonstrate: http://jsfiddle.net/72AzB/

Community
  • 1
  • 1
Felipe Miosso
  • 7,309
  • 6
  • 44
  • 55