0

I would like to know what happens when returning true or false to an onclick?

This is the code,

<button onclick="return test()">Button</button>

<script type="text/javascript">     
    function test() {
        alert("hey");
        return false;
    }
</script>

Changing false to true doesn't change the function behavior.

What exactly does true or false do when returned to onclick?

innowqhy
  • 53
  • 8

0 Answers0