Skip to main content

Bug Tracker

Side navigation

Ticket #4071: test-cumulative-ie.html


File test-cumulative-ie.html, 1.2 KB (added by dom, February 04, 2009 10:56PM UTC)

Illustration of change() event not propagated in IE

<!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' lang='en' xml:lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Test propagation change event in IE</title>
<script type='text/javascript' src='/~dom/js/jquery.js'></script>
<script type="text/javascript">
 $(document).ready(function() {
   // When a select is changed, update the total of the options selected
   $("ul").change(function (e) {
     select=$(e.target);
     ul = $(this);
     total = 0;
     ul.find("option:selected").each(function() {
          total += parseInt($(this).val());
     })
   alert(total);
   });

 });

</script>
</head>
<body>
<p>Changing the values below should trigger an alert showing the total of the values selected.</p>
<ul>
<li><select>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option></select></li>
<li><select>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option></select></li>
</ul>
</body>
</html>

Download in other formats:

Original Format