obtener el estado actual de la casilla de verificación jquery [duplicado]
Frecuentes
Visto 65,537 equipos
39
estoy usando Bootstrap compruebo plugin. How can i find out Whether a check box is checked or not by pressing a button using jquery
$(button).click(function(){
ckb = $("#ickb").(isChecked);
});
2 Respuestas
20
Utilice la herramienta es() :comprobado to get the result as boolean that is true if checkbox is checked.
ckb = $("#ickb").is(':checked');
Or, you can use length, if it is cero then it is not checked.
ckb = $("#ickb:checked").length
Respondido 29 Abr '22, 22:04
The second option is a single column like so $("#ickb:checked").length
Your answer helped me - Michael Oshosanya
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas jquery jquery-ui twitter-bootstrap or haz tu propia pregunta.
Starting jquery 1.6 there have been significant changes the way attributes and properties are dealt with. For your case $('#ickb').prop("checked") should do the trick. This statement will simply return true or false depending upon the checked/unchecked state of the check box. For more details refer to attributes vs. properties section on así Enlace. - RBT