60772

Why does IE (IE8, specifically) not highlight selected option in a multi select box which is disable

Question:

I am having a multi select box in a JSP page which has some options and is disabled.

<select id="mySelectBox" multiple disabled> <option value="first" selected>First</option> <option value="second">Second</option> <option value="third">Third</option> <option value="fourth" selected>Fourth</option> </select>

I have the first and the fourth options selected, but they are not highlighted in IE They are properly highlighted when I use Firefox.

Is there any solution or workaround for this?

<strong>EDIT:</strong> My DOCTYPE is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> But even with that I don't see any difference.

Answer1:

I hope i clearly understand what you want to do, but i can sugest to do it with little jquery?

<script type="text/javascript"> $(document).ready(function() { $("#mySelectBox option:selected").css('background','black'); }); </script>

Answer2:

Interestingly, <a href="http://www.jefclaes.be/2010/02/ie8-fix-disabled-select-not-showing.html" rel="nofollow">this</a> CSS workaround seems to have fixed my issue!!

select[disabled="disabled"][multiple="multiple"]{ background-color:#D4D0C8; } select[disabled="disabled"][multiple="multiple"] option[selected="selected"]{ background-color:navy; }

Interesting because, earlier I had used the same to no effect. Perhaps I had missed out on something then.

Recommend

  • Eclipse > Javascript > Code highlighting not working with Object Notation
  • UWP - Show textbox text highlight while textbox is out of focus
  • Overriding window.location on Webbrowser Control
  • Samsung Galaxy Tab 10.1 and -webkit-tap-highlight-color style?
  • Declaration of does not work with Ionic's ion-nav-view in IBM MobileFirst
  • Animating an SVG Group
  • Unity 5.1 Animator Controller not transitioning
  • Spring Web Flow exception handling
  • How to add regEx in angular filter
  • Lua: Line breaks in strings
  • ZipList with Scalaz
  • Problems with toDataURL HTML5 other ways to get canvas data?
  • Implement JwtBearer Authentication in NSwag SwaggerUi
  • Jquery Mobile pageLoading() Method how does it work?
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • How can I include If-None-Match header in HttpRequestMessage
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Is there a way to save the selected text and highlight it again once the page is refreshed?
  • Parse a date string in a specific locale (not timezone!)
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • azure media services - The request body is too large and exceeds the maximum permissible limit
  • Chrome doesn't support silverlight anymore? How to solve this?
  • D3 nodes and links from JSON with nested arrays of children
  • Highlight one bar in a series in highcharts?
  • Display issues when we change from one jquery mobile page to another in firefox
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • Fetching methods from BroadcastReceiver to update UI
  • Excel - Autoshape get it's name from cell (value)
  • Check if a string to interpolate provides expected placeholders
  • Symfony2: How to get request parameter
  • Do I've to free mysql result after storing it?
  • GridView Sorting works once only
  • RestKit - RKRequestDelegate does not exist
  • Traverse Array and Display in markup
  • How to format a variable of double type
  • How to get icons for entities from eclipse?
  • WPF Applying a trigger on binding failure
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • JaxB to read class hierarchy