Question

I have this form in my site that uses JavaScript to clear the fields when clicked on (highlighted) and also checks to see if all the fields have been filled in. I've used this code for other sites and it works fine. I can't figure out why it doesn't work now! Everything is the same from the previous code!

Was it helpful?

Solution

The problem is that the function addLoadEvent is used before it is defined. Try switching the order of your JavaScript files.

<script type="text/javascript" src="j/global.js"></script>
<script type="text/javascript" src="j/contact.js"></script>

The following code in contact.js currently fails to execute:

addLoadEvent(focusLabels);
addLoadEvent(prepareForms);

Due to the fact that you're loading contact.js before global.js, where addLoadEvent is defined.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top