Skip to main content

Bug Tracker

Side navigation

Ticket #2652: val.html
File val.html, 0.8 KB (added by kowcik, April 04, 2008 03:17PM UTC)

Test case from jQuery documentation

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
	$(document).ready(function () {
			$(':selected').each(function () {
					alert ( $(this).val() )
					})
			})
  </script>
  <style>
  p { color:red; margin:4px; }
  b { color:blue; }
  </style>
<style>html,body{border:0; margin:0; padding:0;}</style></head>
<body>
  <p></p>
  <select id="single">
    <option>Single</option>
    <option>Single2</option>
  </select>
  <select id="multiple" multiple="multiple">
    <option selected="selected">Multiple</option>
    <option>Multiple2</option>
    <option selected="selected">Multiple3</option>
  </select>
</body>
</html>

Download in other formats:

Original Format