0

I'm getting reference error for a simple JavaScript function call. Help me to solve this

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type="javascript">
        function showPopupForIssueReport()
        {
            alert("The first");
        }
    </script>

</head>
<body>
<a href="javascript:void(null)" onclick="javascript:showPopupForIssueReport()">POPUP</a>
</body>
</html>
1

1 Answer 1

5

Your <script> tag has a "type" value that's incorrect for JavaScript. The browser is ignoring it.

Just leave off the "type" attribute completely.

<script>
    function showPopupForIssueReport()
    {
        alert("The first");
    }
</script>

If you feel you must have a "type" (you really don't need it though), use "text/javascript".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.