samedi 9 février 2019

trivially simple function and if-else statement gives syntax error unexpected token ')'

I have a very simple javascript function, it should pop up an alert when a radio button is clicked. If I click the no radio button it works, but if I click yes I get the syntax error unexpected token ')' and I cannot see why.

Code:

    <script>
        function check(val) {
            if (val == "Yes"){
                alert("Yes")
            }else{
                alert("No")
            }
        }
    </script>

Aucun commentaire:

Enregistrer un commentaire