What’s the proper value for a checked attribute of an HTML checkbox?

Just like all input’s, this one also has a ‘value’ attribute. If you set the value attribute along with the name attribute, it will send ${name}=${value} in the headers. Let’s say we had a form with a bunch of stuff and we wanted the user to decide what roles they have, we could use a checkbox. The easiest way is to set the ‘value’ attribute which will be passed along to the server. Like this:

<form action="/server" method="post">
    <label>Are you a person?</label>
    <input type="checkbox" name="my_checkbox" value="is_person">
</form>

The server will receive the following:
my_checkbox=is_person
but only if the checkbox is checked. This would be
my_checkbox=
if it is empty.

This is the exact same with radio inputs.

But.. I have a feeling this isn’t what you’re asking for… So just encase I’ll write another answer below:

If the checked attribute is set to anything (even false) it will be activated, no matter what. The checked attribute doesn’t have a specified value, if it’s set to anything it will default to ‘true’ (even if you set it to false).

For example:

<form action="/server" method="post">
    <label>Are you a person?</label>
    <input type="checkbox" checked="false"> <!--Still checked-->
</form>

Will be checked even though it’s set to false.

<form action="/server" method="post">
    <label>Are you a person?</label>
    <input type="checkbox" checked="asjdiasjiasdjoasi"> <!--Still checked-->
</form> 

Doing this will also check it. It doesn’t matter — as long as it’s set it will be checked.

Hope this answers your question, the checked attribute will check the input no matter the value of the attribute.

You can test it here: https://battledash-2.github.io/Live-IDE/
or anywhere like repl.it, or locally.