jQuery if checkbox is checked
jQuery if checkbox is checked
回答1
for jQuery 1.6 or higher:
if ($('input.checkbox_check').prop('checked')) {
//blah blah
}
the cross-browser-compatible way to determine if a checkbox is checked is to use the property https://api.jquery.com/prop/
评论
Note that "The .prop() method gets the property value for only the first element in the matched set." see api.jquery.com/prop
回答2
if ($('input.checkbox_check').is(':checked')) {
回答3
his $('#checkboxId').is(':checked')
for verify if is checked
& this $("#checkboxId").prop('checked', true)
to check
& this $("#checkboxId").prop('checked', false)
to uncheck
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2021-03-09 Using AntiXss As The Default Encoder For ASP.NET
2021-03-09 What is the difference between AntiXss.HtmlEncode and HttpUtility.HtmlEncode?
2021-03-09 Should I use .done() and .fail() for new jQuery AJAX code instead of success and error
2019-03-09 Inversion of Control Containers and the Dependency Injection pattern
2019-03-09 82. Remove Duplicates from Sorted List II
2019-03-09 83. Remove Duplicates from Sorted List
2018-03-09 fixed和absolute