最終更新:2010-09-13 (月) 14:21:50 (4974d)
jQuery/select
<select id="target"></select> //要素の追加 jQuery('#target').append(jQuery('<option value="1">test1</option>')); //要素の選択 value=1を選択 jQuery('#target').val('1'); //要素の変更のイベントハンドラー jQuery('#target').bind('change', function() { }); //選択された要素の取得 //属性valueの値 jQuery('#target option:selected').val(); //テキストの内容 jQuery('#target option:selected').text(); //選択された複数要素の取得 jQuery('#target option:selected').each(function() { var value = jQuery(this).val(); var text = jQuery(this).text(); });