JQuery操作CheckBox和Radio
生活随笔
收集整理的這篇文章主要介紹了
JQuery操作CheckBox和Radio
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<input type="checkbox" id="dx">多選框
<input type="radio" name="select" value=1>單選1
<input type="radio" name="select" value=2>單選2
<input type="radio" name="select" value=3>單選3
?
一、判斷CheckBox是否選中
var isChecked = $('#dx').is(':checked');//選中返回true,未選中返回false二、獲取Radio的選中值
var checkValue = $('input[name="select"]:checked').val();三、設置CheckBox的勾選狀態
$('#dx').attr('checked',true)四、設置Radio選中
$('input[name="select"]:eq(1)').attr('checked',true); $('input[name="select]').eq(1).attr('checked',true);
?
?
轉載于:https://www.cnblogs.com/ecosu/p/4588079.html
總結
以上是生活随笔為你收集整理的JQuery操作CheckBox和Radio的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 网站如何接入支付宝(转)
- 下一篇: 风险案例-25期-与有过合作经历客户在新