简体   繁体   中英

How to Get value of disabled @Html.CheckBox VB MVC

I have a checkbox in .net MVC and I need to get the value of this checkbox but it is disabled, this is my code:

<div class="editor-field">
   @Html.CheckBox("cbTratamientoFiscal", New With {.class = "checkbox", .disabled = "disabled"})
</div>

I tried something like this in jquery:

var tratamientoFiscal = $("#cbTratamientoFiscal").val();
// also:
var tratamientoFiscal = $("#cbTratamientoFiscal").is(":checked");
// or:
var tratamientoFiscal = $("#cbTratamientoFiscal").attr('checked');

And nothing is working.

Thanks for your help.

如果name属性为'cbTratamientoFiscal',这将为您提供是非题的结果:

$("input[name='cbTratamientoFiscal']").is(':checked')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM