8 examples of 'html checkbox onclick' in JavaScript

Every line of 'html checkbox onclick' 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
19_onClick () {
20 const name = this.props.name
21 const value = !this.props.value
22 this.send('set-value', name, value)
23}
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

3function check_checkbox (checkbox) {
4 if (checkbox.prop('checked')) {
5 checkbox.parents('label.checkbox').addClass('checkbox_state_cheked');
6 } else {
7 checkbox.parents('label.checkbox').removeClass('checkbox_state_cheked');
8 }
9}
31@HostListener('click') onClick()
32{
33 if (this.isDisabled || this.noChanges) return;
34
35 this.model = !this.model;
36 this.changeHandler(this.model);
37}
58onClick(event): void {
59 event.preventDefault();
60 if (!this._disabled) {
61 this.updateValue(!this.checked);
62 }
63}
15handleClick() {
16 // simulate checkbox
17 this.props.onChange({
18 target: {
19 checked: true,
20 },
21 });
22}
31function checkboxClicked() {
32 //compute the new flag value
33 var newFlagValue = 0;
34 for(var i = 0; i < lstFlags.length; i++) {
35 var checkBox = document.getElementById('cb' + i);
36 if(checkBox.checked) {
37 newFlagValue |= lstFlags[i][1];
38 }
39 }
40 var textbox = document.getElementById('tb');
41 textbox.value = newFlagValue;
42 explainFlags();
43}
89function buildCheckbox( checkboxObj ) {
90 var formHtml = '<div>';
91 formHtml += '<div class="col-xs-8 form-group"><label>'+ checkboxObj.info +'</label>';
92 formHtml += '<div class="input-group radio" style="margin-bottom: 0px">';
93 if( checkboxObj.attr ){
94 $.each(checkboxObj.attr, function (index, value) {
95 if( value.value ){
96 formHtml += '<label style="padding-left: 0px;padding-right: 20px"><input type="checkbox" checked name="'+ value.name +'"> '+ value.desc +'</label>';
97 }else{
98 formHtml += '<label style="padding-left: 0px;padding-right: 20px"><input type="checkbox" name="'+ value.name +'"> '+ value.desc +'</label>';
99 }
100 });
101 }
102 formHtml += '</div>';
103 if( checkboxObj.description ){
104 formHtml += ' <div class="col-xs-4 form-group" style="margin-top: 30px"><span class="label label-info">'+ checkboxObj.description +'</span></div>';
105 }
106 formHtml += '</div></div>';
107 return formHtml;
108}
2635function handleCheckboxMultiselectClickOnCheckbox(e)
2636{
2637 var cb = e.currentTarget,
2638 value = cb.get('value'),
2639 select = cb.ancestor('.checkbox-multiselect').next('select');
2640
2641 Y.some(Y.Node.getDOMNode(select).options, function(o)
2642 {
2643 if (o.value == value)
2644 {
2645 o.selected = cb.get('checked');
2646 return true;
2647 }
2648 });
2649}

Related snippets