My header.php:
...
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/plugins/js/form-checker.js"></script>
...
Somewhere in my sidebar.php:
...
<form..onsubmit="return validateForm()">
</form>
...
My script inside template_url/plugins/js/form-checker.js:
...
function validateForm(){
alert("test")
}
...
That’s it!
Hi there!
I used the same way as yours to refer to an external javascript inside my header.php, and it worked well for me, just now. If it’s not working, maybe it’s your script that has a problem…?
Hmm.. Try putting an alert(‘any string’) to the first line of the function inside the script you are calling and test if an alert msg does appear. It’s what I always do to check if my script’s fine.
Hope this could help.. 🙂