Jquery radio Checked


$(“input[name='radio_name']:checked”).val() 或者$("input[name='radio_name'][checked]").val() 

<input type="radio" value="1" name="radio_name"  />1

<input type="radio" value="2"  name="radio_name" />2

<input type="radio" value="3"  name="radio_name" />3

 

select 被選中的text 

var item = $(”select[@name=items] option[@selected]“).text();

 

select下拉框的第二個元素為當前選中值:$(’#select_id’)[0].selectedIndex = 1;

select下拉框value = ‘val’的元素為當前選中項:$(”select[name=items] option[value='val']“).attr(”selected”,”selected”);

radio單選組的第二個元素為當前選中項 :$(’input[@name=items]‘).get(1).checked = true; 或$(’input[name=items]‘).attr(”checked”, ‘1′); 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM