MDB5 Checkbox - check the value in javascript


Topic: MDB5 Checkbox - check the value in javascript

smachesney asked 4 years ago

Hi

I am using the MDB5 checkbox and want to use javascript to check if it's checked or not but the value turns up null. Looking at the window inspector when I check a checkbox, visually it changes but when clicked an "autocomplete" attribute appears but the value is still blank. I have tried setting the tag autocomplete=off but it doesn't work


Dawid Wajszczuk staff answered 4 years ago

Hi.
I would suggest using document.querySelector('#idOfCheckbox').checked . It would return a boolean, true if it is checked and false if it is not checked.


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
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.2.0
  • Device: desktop
  • Browser: Chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No