Note that there are some explanatory texts on larger screens.

plurals
  1. POReseting form fields to initial state
    text
    copied!<p>I am using the below code using Jquery to set my form fields</p> <pre><code> $("#frmlogin").reset() </code></pre> <p>above is the code I use to reset the fields in the below form</p> <pre><code>&lt;form name='frmlogin' method='POST' id="login_form" style="margin:0 auto; margin-top:50px; width: 40%; height:300px; text-align:center;"&gt; &lt;input class="oFormJumbo oFormMed oInputText" type="text" name="requiredLogin" placeholder="Login Id" AUTOCOMPLETE=OFF /&gt; &lt;div class="cleaner h10"&gt;&lt;/div&gt; &lt;input class="oFormJumbo oFormMed oInputText " type="password" value="" name="password" placeholder="Password" AUTOCOMPLETE=OFF onfocus="changetoUpperCase(document.frmlogin.requiredLogin.value);" /&gt; &lt;div class="cleaner h10"&gt;&lt;/div&gt; &lt;a href="javascript:fp();"&gt;Forgot Password?&lt;/a&gt; &lt;div class="cleaner"&gt;&lt;/div&gt; &lt;input style="margin-left:0px; " class="submit_btn float_l" type="button" value="Sign In" name="Sign In" onClick="javascript:func_get_data();"/&gt; &lt;input style="margin-left: 200px; " class="submit_btn float_r" type="button" value="Reset" id="reset" name="reset" onclick="javascript:Reset()"/&gt; &lt;/form&gt; </code></pre> <p>For some reason the code is not working. The JavaScript is throwing the following exception</p> <pre><code>TypeError: $("#frmlogin").reset is not a function [Break On This Error] $("#login_form").reset() </code></pre> <p>Can anyone Tell me Why is it not working?. I have included Jquery.js. </p> <p>According to Adils suggestion I even tried </p> <pre><code>*$("#login_form")[0].reset()* </code></pre> <p>now it gives</p> <pre><code>TypeError: $("#frmlogin")[0] is undefined [Break On This Error] $("#frmlogin")[0].reset() </code></pre> <p>What is it I am missing?</p> <p>I tried every code suggested bellow except Amit Agrawal since I want to use Jquery. None wok. I know my code to rest is proffer. There is something that I am missing in the form</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload