7 examples of 'if checkbox is checked value 1 else 0 in php' in JavaScript

Every line of 'if checkbox is checked value 1 else 0 in php' 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
55function getCheckboxValue(field){
56 if ($('#' + field + ':checked').attr('checked')) {
57 return 1;
58 }else{
59 return 0;
60 }
61}
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

78function set_checkbox_value(id, value) {
79 $('#' + id).prop('checked', value);
80}
74function set_radio_checked(id) {
75 $('#' + id).prop('checked', true);
76}
5function checkboxChanged(checkboxInput) {
6 var $rgbaInput = $(checkboxInput).siblings('input.cascade-rgba');
7 var $colorInput = $(checkboxInput).siblings('input[type="color"]');
8 if (checkboxInput.checked || checkboxInput.disabled) {
9 $rgbaInput.addClass('disabled');
10 $colorInput.addClass('disabled');
11 } else {
12 $rgbaInput.removeClass('disabled');
13 $colorInput.removeClass('disabled');
14 }
15}
191function isChecked(checkboxElement) {
192 return checkboxElement.hasClass(CHECKED_CSS);
193}
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}
110function isChecked(id,name){
111 var elem = goog.dom.getElement(id);
112 return elem.checked;
113};

Related snippets