Problem w/ Double Click Event in IE
I have the following code, which displays a letter in the green box when you double-click on it. It works with a function attached to the doubleclick event of OPTION elements. The code works in Firefox and Google Chrome, but I can't get it to work in any version of IE and I don't know why. Any ideas on how to get this to work in IE? Am I doing something wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test jQuery</title>
<style type="text/css">
form {
margin: auto;
padding: 1em;
width: 500px;
height: 500px;
border: thin solid black;
}
div {
border: thin solid red;
margin: auto;
padding: 1em;
}
p {
margin: auto;
width: 3em;
height: 3em;
border: thin solid green;
text-align: center;
}
</style>
<script
type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("option").dblclick(function(){
$("#display").text($(this).val());
});
});
//]]>
</script>
</head>
<body>
<form action="test.html">
<div>
<select size="3">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<p id="display">
</p>
</div>
</form>
</body>
</html>