Jesse Elser
Jesse Elser

Reputation: 976

Bootstrap Checkbox Name

I haven't used checkboxs with the Bootstrap library yet so I'm trying to clarify something. I've been reading the documentation on Bootstrap form elements and noticed that none of the checkboxs have a name attribute. It has been my understanding that a checkbox needs a name.

For example this is what the Bootstrap website gives as an example:

<div class="checkbox">
  <label>
    <input type="checkbox" value="">
    Option one is this and that&mdash;be sure to include why it's great
  </label>
</div>

But if I were to use this wouldn't it have a name attribute like this:

<div class="checkbox">
  <label>
    <input type="checkbox" value="" name="bootstrapCheck">
    Option one is this and that&mdash;be sure to include why it's great
  </label>
</div>

Upvotes: 1

Views: 1093

Answers (1)

KayR
KayR

Reputation: 50

It's not necessary that they add the name, you can always add the name to it according to your requirement.

The name attribute is used to reference form data after it's submitted, and to reference the data using JavaScript on the client side

Upvotes: 1

Related Questions