Topic: initialize checkbox to checked using javascript

Taomgirl pro asked 4 years ago

I want to change checkbox to checked based on an if statement in my code. I don't see any documentation on how to manipulate them since the id seem to tie to their state.

Piotr Glejzer staff commented 4 years ago

Hi, what exactly do you want? Which if / else statement? Best, Piotr

Taomgirl pro answered 4 years ago

I want to check the box based on code not user clicking a button.

Piotr Glejzer staff commented 4 years ago

Hi, Something like that? if($('#your-checkbox-id').is(':checked')){ // do something } else{ // do smething } Best, Piotr

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

  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.10
  • Device: mac
  • Browser: chrome
  • OS: ios
  • Provided sample code: No
  • Provided link: No