Jquery 获取select,option,radio选中对象与值(不断更新中)

来源:互联网 发布:fft算法三级实现 编辑:程序博客网 时间:2024/06/05 21:09


 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需要替换成你定义的。

0 0