jeudi 30 juillet 2015

jQuery action on HTML Checkbox

I am having a little bit of trouble understanding why my checkbox is not producing any action. I would appreciate any suggestion as to where my mistake occurred. Thank you!

Best, Ray

<!DOCTYPE html>

<head>
</head>

<body>
<form>
        <div id = "canada1"> <input type ="checkbox" name ="location" value ="canada"> Canada <br><div>
    <div id = "central_america1"> <input type ="checkbox" name ="location" value ="central_america"> Central America <br></div>
</form>

<script type = "text/javascript" src='http://ift.tt/1APuVEV'></script>

<script type = "text/javascript">

        $(document).ready(function(){
                alert("this appears")

                $('#canada1').click(function() {

                        if ($('#canada1').is(':checked')) {
                                alert("Canada is checked");
                                console.log("is this working?")
                        };

                });
        });
</script>
</body>
</html>



Aucun commentaire:

Enregistrer un commentaire