Wednesday, March 11, 2020

How To Check Whether CheckBox Is Checked/Selected/Ticketed Or Not in LWC

If you want to check this functionality we can relay on the event object of the java script which will tells you whether check box is selected or not.
checkboxSelection.html

<template>
 <lightning-input type="checkbox" label="" onchange={selectDeselectAll}>
    </lightning-input>
</template>

checkboxSelection.js

import { LightningElement} from 'lwc';
export default class CheckBoxClassDet extends LightningElement
{
    
 selectDeselectAll(event) {
        if (event.target.checked)
  {
    console.log('Check box is checked');
  }
  else
  {
    console.log('check box is unchecked');
  }
}

Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.




Hope this helps you..Enjoy..!