jQuery日本語リファレンス

jQuery does not mean Japanese Query...

ヌー

Selectors/API/jQuery - Sample Code

:selected

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
 "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <script src="/jquery/js/jquery.js"></script>
 
 <script>
 $(document).ready(function(){
 
 $("select").change(function () {
 var str = "";
 $("select option:selected").each(function () {
 str += $(this).text() + " ";
 });
 $("div").text(str);
 })
 .trigger('change');
 });
 </script>
 <style>
 div { color:red; }
 </style>
</head>
<body>
 <select name="garden" multiple="multiple">
 <option>Flowers</option>
 <option selected="selected">Shrubs</option>
 <option>Trees</option>
 <option selected="selected">Bushes</option>
 <option>Grass</option>
 <option>Dirt</option>
 </select>
 <div></div>
</body>
</html>
 
 
[実行結果] [フレーム]
[:selected の説明へ]
© Copyright 2009 by semooh.jp | Design by Free CSS Templates - Thanks to Dubai Apartments

AltStyle によって変換されたページ (->オリジナル) /