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
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.
i think it's because the line
<input type="submit" name="login" id="submit" style="visibility:hidden" />
can you remove it and retry?
I waster 3 hours trying to fix the same issue, I was using the name='submit' for my submit button and was calling $("#form_name").submit(); in a function and was getting the error. Sometimes small things I overlook end up wasting lot of time.
Your form
and input
have the same name attribute value, login
.
Change the name
on the input
to something else, like submit
. This should clear up your error.
With jQuery 1.7 (possibly above too) if you have the name
property also called submit
it will break.
E.g.
<input type="submit" name="submit" value="Upload">
Will not work, however:
<input type="submit" name="sendSubmit" value="Upload">
Is fine.
When we use a submit type element in a form, This element will be set as Submit property of the form. So one could not call the submit() function with other element of form.
There are two ways to do this. first one is just remove the line as given in first reply.
Or Use $("#submit").trigger("click"); instead of $("#login").submit();. and it will submit the form on pressing enter key word too.