blackcurrantapps pro asked 6 years ago

Checkbox doesn't work even if the id attribute of input element and for attribute of label element is same.
<input type="checkbox" value="{{ $option }}"
 id="{{ $option->other_option_id }}">
<label for="{{ $option->other_option_id }}"
This doesn't work but when I append any string to it like "_check" it works.
<input type="checkbox" value="{{ $option }}"
 id="{{ $option->other_option_id }}_check">
<label for="{{ $option->other_option_id }}_check"
The second piece of code is able to manipulate checkbox state. I am not able to understand why the first piece of code doesn't work.

jordansgr free answered 4 years ago

For my.

That works.

That doesn't

Grzegorz Bujański staff commented 4 years ago

Hi. Input should be sibling with label - not children. Look at example here:

Mikołaj Smoleński staff answered 6 years ago

Hi, Your checkbox works fine. Try to find the bug in the rest of Your code or update MDB to the latest release. Regards

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No