lukieleetronic lukieleetronic - 7 months ago 15
jQuery Question

jQuery not binding to the form,

I'm having problem with the following code,

The submit button is not binding to the jQuery script and the console is not printing anything. I can't figure out what the problem is..


<script src="//"></script>


// Variable to hold request
var request;

// Bind to the submit event of our form

console.log ("Im here");


<!--form action="getVehiclePosition.php" method="GET"-->
<!--Name: <input type="text" name="name"><br>-->
<form id="show">
<input type="submit" value="Send">



You code is not working as at the time the script is interpreted and executed, the form does not exist in the DOM. Wrap your code in document-ready handler.

Specify a function to execute when the DOM is fully loaded.


 $(function () {
    //Your code

OR, You can place the script tag below the form element