Using Javascript to submit forms.
Posted
by Razor Storm
on Stack Overflow
See other posts from Stack Overflow
or by Razor Storm
Published on 2010-06-06T17:38:11Z
Indexed on
2010/06/06
17:42 UTC
Read the original article
Hit count: 418
I am using a jQuery function to submit a form when a certain button is pressed, however this seems to have no effect on the form.
My code is as follows: HTML:
<form id="loginForm" action="" method="POST">
<input class="loginInput" type="hidden" name="action" value="login">
<input id="step1a" class="loginInput" type="text" name="username">
<input id="step2a" class="loginInput" type="password" name="password" style="display:none;">
<input id="step1b" class="loginSubmit" onclick="loginProceed();" type="button" name="submit" value="Proceed" title="Proceed" />
<input id="step2b" class="loginSubmit" onclick="submitlogin();" type="button" value="Validate" title="Validate" style="display:none;" />
Javascript:
function submitlogin()
{
$("form").submit();
}
However, when I press the button, absolutely nothing occurs.
PS. This function may seem meaningless since I can just use a input type="submit" but I originally intended this to have some more functionality, I stripped the function to its bare bones for testing purposes.
© Stack Overflow or respective owner