Site Navigation

Wednesday, November 14, 2007

bug 280 - lack of events for options

Issue: #280
Affects: IE5, IE5.5, IE6, IE7, IE8, IE9 PP4, IE9 RC 1, Opera, Safari 3, Safari 4 Beta, Chrome v1, ?
Partially Fixed in: Opera 9.5-9.64 (onclick, onmouseover, onmouseout, onmousedown, onmouseup fixed!)
Partially Fixed in: Safari 4.0 (onclick, onmouseover, onmouseout, onmousedown, onmouseup fixed!)
Partially Fixed in: Chrome 2.0 (onclick, onmouseover, onmouseout, onmousedown, onmouseup fixed!)


The option element is used inside a select element to provide options for the user to select from. Like all visually displayed elements in the browser, you can attach event handlers to them too.

Well, not quite. The following table indicates the level of support for each browser, and event.












EventFirefoxInternet
Explorer
KonquerorOperaSafariChrome
onclickYesNo?YesNo (v4.0 Yes!)No (v2.0 yes!)
onmouseoverYesNo?No (v9.5 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
onmouseoutYesNo?No (v9.5 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
onmousedownYesNo?No (v9.64 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
onmouseupYesNo?No (v9.64 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
keyupNoNo?NoNoNo
keydownNoNo?NoNoNo
keypressNoNo?NoNoNo


Only Firefox seems to support the full array of mouse events, Opera is next supporting an onclick event, but in IE and Safari(win) there is no support for mouse events on options.

Oddly enough, no browser seems to support keyboard events on options.

View the following samples in Firefox, Safari or Opera and IE.

Example:






Known Workarounds: None.

Related Issues: bug 291.