Quantcast
Channel: Idowebdesign
Viewing all articles
Browse latest Browse all 10

IE select onchange issue

$
0
0

This is a quick tip on how to support the onChange behavior for a select box in IE8.

For some reason IE 8 does not handle the onChange attribute of a select box.


<select name="bowsers" id="browsers" onChange="alert('test');">

<option>FF4</option>

<option>IE</option>

<option>Chrome</option>

</select>

Here is a fix than can be used to make this working


<select name="bowsers" id="browsers">

<option>FF4</option>

<option>IE8</option>

<option>Chrome</option>

</select>

<script type="text/javascript">
var selectmenu = document.getElementById("browsers");

selectmenu.onchange = function()
{
 alert('test');
}

</script>


Viewing all articles
Browse latest Browse all 10

Trending Articles