$("input[type='checkbox']").is(':checked')
//返回结果:选中=true,未选中=false在这里插入代码片
var chk_value =[];
$('input[name="test"]:checked').each(function(){
chk_value.push($(this).val());
});
$("document").ready(function() {
$("#btn1").click(function() {
$("[name='checkbox']").attr("checked", 'true'); //全选
}) $("#btn2").click(function() {
$("[name='checkbox']").removeAttr("checked"); //取消全选
}) $("#btn3").click(function() {
$("[name='checkbox']:even").attr("checked", 'true'); //选中所有奇数
}) $("#btn4").click(function() {
$("[name='checkbox']").each(function() { //反选
if ($(this).attr("checked")) {
$(this).removeAttr("checked");
} else {
$(this).attr("checked", 'true');
}
})
})
})
$("#select").val()
$('input:radio:checked').val();
$("input[type='radio']:checked").val();
$("input[name='rd']:checked").val();
$('input:radio:first').attr('checked', 'checked');
$('input:radio:first').attr('checked', 'true');
$('input:radio:last').attr('checked', 'checked');
$('input:radio:last').attr('checked', 'true');
$('input:radio').eq(索引值).attr('checked', 'true');//索引值=0,1,2....
$('input:radio').slice(1,2).attr('checked', 'true');
$("input[value='rd2']").attr('checked','true');