Start New Discussion within our Web Development Community

Hello friends got a simple question again(im a noobi i know)

so got i got a checkbox in html i want to know how to manipulate checkboxes how i know if its checked...

blehh i explain in the code

<!DOCTYPE html>

<head><script type="text/javascript">

function myFunction() {
if (// checkbox is checked<<< this is my question how i write this ) {
//do this




<input id="box1" type="checkbox" name="box1"/>                          //check box..
<input id="button" type="button" onclick="myFunction();" />     // boton , so ..say i want to alert Hello only if it checked
                                                              // how i do that? 



thx u guys rock!

Try this

    if(document.getElementById('box1').checked == true){
        alert('not checked')
This question has already been answered. Start a new discussion instead.