确定是否使用jQuery选中了Checkbox [英] Determine if Checkbox is Checked using jQuery

查看:70
本文介绍了确定是否使用jQuery选中了Checkbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
使用jQuery选中复选框选中的属性

Possible Duplicate:
Check checkbox checked property using jQuery

访问复选框以检查复选框是否正确?是否有必要先检查DOM中是否存在该元素,然后查看是否已检查?

What is the correct way of accessing a checkbox to check if it's checked? Is it necessary to first check if that element exists in the DOM and then see if is checked or not?

推荐答案

您将使用选中的选择器以及Jquery的is方法

You would use the checked selector along with the is method of Jquery

if($('#chkbox').is(':checked')){

}

这篇关于确定是否使用jQuery选中了Checkbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆