I have this jquery script, and it does not work in head tag.
<script type="text/javascript">
$(window).load(function() {
$( "#target" ).submit(function( event ) {
alert( "Handler for .submit() called." );
event.preventDefault();
});
}
</script>
But if I put the code below the form it usually works.
I want to put it in a .js file. But does not work in the head tag, only if I include after the form.
It is possible to make this code work in head tag?