Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: e[h] is not a function

I've been using jquery 1.6 with no problem. Today I switched to jquery 1.8 and suddenly I am getting this error when trying to submit a form:

TypeError: e[h] is not a function.

Form:

<form method="post" action="login?login" name="login" id="login">
<input class="input" type="text" name="user_mail" id="user_mail" autocomplete="on" />
<input class="input" type="password" name="password" id="password" autocomplete="off" />
<a class="green_button" href="javascript:void(0)" id="login_button">Login</a>
<input type="submit" name="login" id="submit" style="visibility:hidden" />
</form>
<script language="javascript">
$("#login_button").click(function(){
    $("#login").submit();   
});
</script>

Am I missing something?

Thanks!

like image 223
Fede E. Avatar asked Aug 16 '12 02:08

Fede E.


People also ask

Is not a function JS error?

The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.

Is not a function at onclick?

onclick is not a function" error occurs, because there is no onclick() function in jQuery. To solve the error, use the click function instead, e.g. $('#btn'). click(function () {} .


1 Answers

Remove the line below.

<input type="submit" name="login" id="submit" style="visibility:hidden" />

Update:

Or if you have to use the submit input, then you need to change the id submit to something else. The reason is that if you have an input element with id of submit, it will set a submit property to the form with the HTMLInputElement. So you could not call the .submit method on the HTMLFormElement.

like image 80
xdazz Avatar answered Oct 05 '22 05:10

xdazz