lundi 8 août 2016

Get checkbox selected state with JQuery

i tried ´many ways to get the selected state of a checkbox. Its a input field with type checkbox.

i tried the following methods to get the state, but all returns "false". ONLY if the checkbox was set selected/not selected with JQuery before (this was done with $.prop("checked", "true").

$.prop("checked");
$.val(); <-- returns "on" everytime
$.attr("checked");
$.checked; <-- undefined

Nothing works... Do you got an idea?

Regards




Aucun commentaire:

Enregistrer un commentaire