Jquery select,option,radio選択オブジェクトと値を取得(更新中)

508 ワード

1、ページのロード時に値に応じて自動的に選択します.
 $("#bookLevel option[value='${textbook.bookLevel}']").attr("selected",true);

2、ページradioで選択した値を取得します.
$('input[name="testradio"]:checked').val();
$('input:radio:checked').val();
$('input[@name="testradio"][checked]');
$('input[name="testradio"]').filter(':checked');

以上のnameまたはidは、あなたが定義したものに置き換える必要があります.