About 1,140,000 results
Open links in new tab
  1. javascript - If statement when checkbox is checked? - Stack Overflow

    Nov 2, 2016 · var isCheckedWithGlobalVariable = false; $('#myInput:checked').click(function() { // only if it is checked isCheckedWithGlobalVariable = true; }) Or with multiple elements: var …

  2. How TO - Display Text when Checkbox is Checked - W3Schools

    // If the checkbox is checked, display the output text if (checkBox.checked == true){ text.style.display = "block"; } else { text.style.display = "none"; }}

  3. How to check if checkbox is checked in JavaScript - Atta-Ur …

    Jul 31, 2022 · You can use the following code to check if the checkbox is checked or not: const elem = document . querySelector ( '#checkbox' ) if ( elem . checked ) { console . log ( ` …

  4. If, Else, and User Input | Dev-HQ: JavaScript Tutorial

    JavaScript: If, Else, and User Input. Now we know how to store values in variables, it's probably worth learning about how to get user input and store this in variables, and also how we can …

  5. JavaScript if...else Statement (with Examples) - Programiz

    The syntax of the else if statement is: // check for first condition if (condition1) { // if body } // check for second condition else if (condition2){ // else if body } // if no condition matches else { // else …

  6. javascript - How can I check if a checkbox is checked ... - Stack Overflow

    function validate() { var remember = document.getElementById("remember"); if (remember.checked) { alert("checked"); } else { alert("You didn't check it! Let me check it for …

  7. How To Check if a Checkbox is Checked With JavaScript or jQuery

    Here’s an example of how to check if a checkbox with the ID “myCheckbox” is checked using JavaScript: var checkbox = document.getElementById("myCheckbox"); if (checkbox.checked) …

  8. Check If a Checkbox Is Checked in JavaScript - Online Tutorials …

    In this tutorial, we will learn to check whether a checkbox is checked in JavaScript. The checkbox is the input type in the HTML, which works as the selection box. The radio buttons which …

  9. HTML DOM Input Checkbox checked Property - W3Schools

    The checked property sets or returns the checked state of a checkbox. This property reflects the HTML checked attribute.

  10. How to Check if a Checkbox is Checked in JavaScript

    Oct 8, 2020 · We can check if it is checked by looking for .foo:checked using the document.querySelector() method. If a checkbox is not checked null will be returned. if (result) …

Refresh