burf
burf

Reputation: 25

Uncaught ReferenceError: test (function) is not defined

I am sorry in case my formatting of the query is incorrect... Although there are a number of threads on this topic but the suggestions can't seem to solve my issue.

I am getting the Uncaught ReferenceError: test (function) is not defined error in Google Chrome.

Following is the simplest of functions that I could create in order to isolate the issue

<script language="text/javascript">
    function test(form){
        alert("test");
    }

</script>

Equally simple is the HTML here:-

<form id="cpmcalcform">
    <input type="button" value="Alert" onClick="test(this.form);">
</form>

Thanks for your help.

Upvotes: 1

Views: 9510

Answers (1)

Daniel
Daniel

Reputation: 6481

<script language="text/javascript"> is deprecated.

Use <script type="text/javascript">:

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

</script>
<form id="cpmcalcform">
    <input type="button" value="Alert" onClick="test(this.form);">
</form>

Upvotes: 1

Related Questions