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 }}"
 class="label-table"></label>
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"
 class="label-table"></label>
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.https://prnt.sc/s06o51

That doesn't https://prnt.sc/s06oaa


Grzegorz Bujański staff commented 4 years ago

Hi. Input should be sibling with label - not children. Look at example here: https://mdbootstrap.com/docs/jquery/forms/checkbox/


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.

FREE CONSULTATION

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

Status

Answered

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
Tags