'onclick' event not showing expected result

<script type="text/javascript">
    
        function image_style() {

    getElementById("image").src = "cappuccino.png";

  }

</script>

output-no change

@sapnaky55 Do make sure that the “cappuccino.png” is in the same folder in which the above code file is.

Also do share the HTML, and JS file for us to pin point the issue.

Issue Solved.

I wrote getElementById() instead of document.getElementById().

Thanks for responding.

1 Like