Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:52:29+00:00 2026-06-14T03:52:29+00:00

Possible Duplicate: Check if checkbox is checked with jQuery I am a little bit

  • 0

Possible Duplicate:
Check if checkbox is checked with jQuery

I am a little bit confused about how the input of type checkbox works.

If I set a value, say 1, on a checkbox, I see that regardless of the checkbox is checked or not, the value that I get when the form is submitted is 1.

<input type="checkbox" value="1">

So, the correct way to see if a checkbox is checked is to use the checked from jQuery? Or how it can be done correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:52:30+00:00Added an answer on June 14, 2026 at 3:52 am

    Checkbox values should not get submitted if they are not checked.

    If you want to check with jQuery, I would always use:

    var isChecked = $('#checkbox').prop('checked');
    

    Or

    var isChecked = $('#checkbox').is(':checked');
    

    With JavaScript, you have to understand the difference between attributes and properties. checked is both a property and an attribute. However, the attribute checked isn’t always updated when the checked property of a checkbox changes (in some browsers it is). Think of the attribute as the value in the HTML markup parsed by the DOM. The checked property is an actual member of the checkbox element in the DOM, which always changes based on whether the box is checked or unchecked in the UI.

    If you want to try a foolproof method without needed JavaScript, you can try it the “MVC” way, by rendering a hidden input and a checkbox with the same name, each with appropriate “checked”-state values:

    <input type="hidden" name="mybox" value="false" />
    <input type="checkbox" name="mybox" value="true" />
    

    When you submit the form, if you can’t find a mybox value in the request with a value of “true” then the checkbox was not checked. More about that here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Check checkbox checked property using jQuery I am having an issue picking
Possible Duplicate: How do I check a checkbox with JQuery or Javascript? I'm trying
Possible Duplicate: Change icons of checked and unchecked for Checkbox for Android customize check
Possible Duplicate: Javascript or Jquery to check and uncheck all checkbox I have 12
Possible Duplicate: add an image to a html type input check box or radio
Possible Duplicate: C/C++ check if one bit is set in, i.e. int variable e.g.
Possible Duplicate: check if value exists in array in Ruby I have this method
Possible Duplicate: Checkbox Stays Checked on Page Refresh Please see the image carefully. This
Possible Duplicate: Check of specific radio button is checked I have these 2 radio
Possible Duplicate: Check if value isset and null If I have $v = NULL;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.