Link to home
Start Free TrialLog in
Avatar of elepil
elepil

asked on

Form not submitting, can someone please tell me what I'm doing wrong?

The form somehow doesn't find the JavaScript function 'validateForm()', and I'm not sure why. Can someone please tell me what I'm doing wrong?

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script>
$(function() {

function validateForm() {
    alert("It got to validateForm()");
}

});
        </script>
    </head>
    <body>
        <form onsubmit="return validateForm();">
            Home Phone:<br/>
            <input type="text" id="txtHomePhone"/><p>
            Work Phone:<br/>
            <input type="text" id="txtWorkPhone"/><p>
            
            <input type="submit" /><p>
        </form>
    </body>
</html>

Open in new window


Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Duy Pham
Duy Pham
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of elepil
elepil

ASKER

Thanks!