@ Html.checkboxfor-使用ID获取复选框值 [英] @Html.checkboxfor - Get checkbox value using id
本文介绍了@ Html.checkboxfor-使用ID获取复选框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,用户可以选择选中或取消选中右"字段.我可以使用@ html.checkboxfor
In my application, user has a choice to check or uncheck a field "Right". I could able to set the model values to the checkbox using @html.checkboxfor
@Html.CheckBoxFor(x => x.Right, new { id="right"})
有人可以帮助我如何使用ID获取值. 现在,我正在使用$(#right").val()来获取值.但这是行不通的.有人请帮我解决这个问题.
Can someone help me how to get the value using the id. For now i am using $("#right").val() to get the value. But it is not working. Someone please help me to solve this issue.
推荐答案
使用:
$("#right").prop('checked')
OR
$("#right").is(":checked")
这篇关于@ Html.checkboxfor-使用ID获取复选框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文