9 examples of 'checkbox event listener' in JavaScript

Every line of 'checkbox event listener' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
82onCheckboxChange(event: any) {
83 event.stopPropagation();
84 this.change.emit(this.changeEvent);
85}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

189function handleCheckboxChange (e) {
190 // TODO: keep track of selected items/rows, for now just output
191 let checkbox = e.currentTarget;
192 // TODO: this seems very fragile, what if HTML hierarchy changes? Need better way.
193 checkbox.parentNode.parentNode.parentNode.classList.toggle('active');
194
195 let msg = (checkbox.checked ? "Selected: " : "Unselected: ") + checkbox.value;
196 let event = new CustomEvent('RowSelectionChanged', {"value": msg});
197 event.initCustomEvent('RowSelectionChanged', true, true, {"value": msg});
198 this.dispatchEvent(event);
199}
58onClick(event): void {
59 event.preventDefault();
60 if (!this._disabled) {
61 this.updateValue(!this.checked);
62 }
63}
223_handleCheckboxChanged(event)
224{
225 this._updateCheckboxTitle();
226 this.dispatchEventToListeners(WI.VisualStyleSelectorTreeItem.Event.CheckboxChanged, {enabled: this._checkboxElement.checked});
227}
185private checkboxChange(item: any): void {
186 this.onCheckboxChange.emit({
187 item: item
188 } as ListEvent);
189}
114onCheckboxChange(event: any) {
115 event.stopPropagation();
116 timer(0).subscribe(() => this.change.emit(this.changeEvent));
117}
116selectedCheckBox(event:any,rowno: number,data:any){
117 if(event.currentTarget.checked){
118 this.selectedData.push(data);
119 }
120 else{
121 var indexOf = this.selectedData.indexOf(data);
122 delete this.selectedData[indexOf];
123 }
124
125 const sdata = []
126
127 for(var i=0;i<this.selectedData.length;i++){
128
129 if(this.selectedData[i]){
130 sdata.push(this.selectedData[i]);
131 }
132 }
133
134 this.selectedRows.emit(sdata);
135}
91onCheckboxClicked(ev: Event) {
92 ev.stopPropagation();
93 this.taskComplete.emit();
94}
31@HostListener('click') onClick()
32{
33 if (this.isDisabled || this.noChanges) return;
34
35 this.model = !this.model;
36 this.changeHandler(this.model);
37}

Related snippets