Internet Explorer Quirks

See also:

SCRIPT tags - TYPE attribute

type='application/javascript' doesn't work
type='text/javascript' works

Caching of AJAX calls

IE is know for aggressively caching AJAX results. To bypass this, use the following code.

$.ajaxSetup({ cache: false });

Setting Value of Dropdowns

When setting the value of a drop down list and the value doesn't exist in the list, the behavior is browser-dependent.

Image Titles

When an tag doesn't have a TITLE attribute, FF and Chrome show no tooltip; IE shows a tooltip containing the image's file name. The work-around is to change the tag to have an empty TITLE attribute.

Images for List Item Bullets

The following CSS will use the bullet.gif file as a bullet for the list items, but it doesn't work consistently in IE. (Some list items will have no bullet.)
li { background: url('bullet.gif') no-repeat left 5px; }

Work-around: The following CSS fixes the above problem.
li { list-style-image: url('/bullet.gif'); }

Drop Down Lists without Underlying Values

If you have a dropdown list (a <select> tag) where the options listed don't have underlying values (i.e., no value attribute), when the enclosing form is submitted, the dropdown list's value won't be included. (This issue seems to have been resolved in IE9.)

Change this...
<select name="Color">

To this...
<select name="Color">
    <option value="Blue">Blue</option>
    <option value="Red">Red</option>
    <option value="Green">Green</option>

String Trim Function

The string trim function doesn't work in IE8 as it does in other browsers. Sometimes it fails silently; sometimes it gives the error message "Object doesn't support property or method 'trim'", possibly within a jQuery JavaScript file. The fix is to use the alternate syntax given below.

$(selector).val().trim()     // gives error in IE8

$.trim($(selector).val())    // use this syntax instead