0

I am trying to write a simple code as follows:

<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" />
    <script>
        $("#submitQuery").click(function() {
            alert("Hola!!");
        });
    </script>
    </head>
    <body>
        <label for="geo_location"> Enter location here: </label>
        <input id="geo_location" type="text" name="geo_location" required />
        <button id="submitQuery">Find out</button>
        <div id="test"></div>
    </body>
</html>

However, clicking the button doesn't do anything. Where am I wrong here?

1 Answer 1

3
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" /> </script>
<script>
    $(function(){
         $("#submitQuery").click(function() {
             alert("Hola!");
         });
    });
</script>

try this...you miss the ready function..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.