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..!

1 comment:

  1. hi my req is for example student is a object having 10 students record and another object area of interest in this object having list in checkbox ,create a lwc component if i select any one student record it will show the list what are the area of interest pls help me out how to do it

    ReplyDelete