2

I'm using JQuery to POST a form. I'm having trouble getting the proper value from this field:

<input type="checkbox" name="facebook" value="true" checked="checked" id="facebook"/>

My JQuery:

var facebook = $("input#facebook").val();

I realize now that I'm getting the value with is always "true" regardless of being checked or not. So how do I get whether it's checked or not?

1 Answer 1

9
var facebook = $('input#facebook').is(':checked');
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.