this is my checkbox
HTML
JQuery
var eu_want_team = $('#eu_want_team').val();
alert(eu_want_team);
Its always displaying ON, is it checked or not. Whats the problem with it?
Answer
Use .is(':checked')
instead: Working jsFiddle
var eu_want_team = $('#eu_want_team').is(':checked');
alert(eu_want_team);
or as @Itay said in comments you can use jQuery's .prop()
to get the checked property value:
alert($("#eu_want_team").prop("checked"));
No comments:
Post a Comment