Skip to main content
Pressed the tidy button
Source Link
Douwe de Haan
  • 6.7k
  • 3
  • 35
  • 53

Use this below simple code: https://jsfiddle.net/Divyesh_Patel/v7a4h3kr/7/

<input type="checkbox" id="check"> <a href="#" onclick="check()">click</a> <button onclick="check()">button</button> <script>   function check() {   if (document.getElementById('check').checked) {   alert("checked");   } else {   alert("Not checked.");   }     }   </script>

Use this below simple code: https://jsfiddle.net/Divyesh_Patel/v7a4h3kr/7/

<input type="checkbox" id="check"> <a href="#" onclick="check()">click</a> <button onclick="check()">button</button> <script> function check() {   if (document.getElementById('check').checked) {   alert("checked");   } else {   alert("Not checked.");   }     }   </script>

Use this below simple code: https://jsfiddle.net/Divyesh_Patel/v7a4h3kr/7/

<input type="checkbox" id="check"> <a href="#" onclick="check()">click</a> <button onclick="check()">button</button> <script>   function check() { if (document.getElementById('check').checked) { alert("checked"); } else { alert("Not checked."); } } </script>

Source Link
Divyesh
  • 161
  • 2
  • 8

Use this below simple code: https://jsfiddle.net/Divyesh_Patel/v7a4h3kr/7/

<input type="checkbox" id="check"> <a href="#" onclick="check()">click</a> <button onclick="check()">button</button> <script> function check() { if (document.getElementById('check').checked) { alert("checked"); } else { alert("Not checked."); } } </script>