use*_*270 1 javascript css forms jquery
我使用下面的代码使用Jquery来设置我的表单字段
$("#frmlogin").reset()
Run Code Online (Sandbox Code Playgroud)
上面是我用来重置下面表单中的字段的代码
<form name='frmlogin' method='POST' id="login_form" style="margin:0 auto; margin-top:50px; width: 40%; height:300px; text-align:center;">
<input class="oFormJumbo oFormMed oInputText" type="text" name="requiredLogin" placeholder="Login Id" AUTOCOMPLETE=OFF />
<div class="cleaner h10"></div>
<input class="oFormJumbo oFormMed oInputText " type="password" value="" name="password" placeholder="Password" AUTOCOMPLETE=OFF onfocus="changetoUpperCase(document.frmlogin.requiredLogin.value);" />
<div class="cleaner h10"></div>
<a href="javascript:fp();">Forgot Password?</a>
<div class="cleaner"></div>
<input style="margin-left:0px; " class="submit_btn float_l" type="button" value="Sign In" name="Sign In" onClick="javascript:func_get_data();"/>
<input style="margin-left: 200px; " class="submit_btn float_r" type="button" value="Reset" id="reset" name="reset" onclick="javascript:Reset()"/>
</form>
Run Code Online (Sandbox Code Playgroud)
由于某种原因,代码无法正常工作.JavaScript抛出以下异常
TypeError: $("#frmlogin").reset is not a function
[Break On This Error]
$("#login_form").reset()
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我为什么它不起作用?我已经包含了Jquery.js.
根据Adils的建议,我甚至尝试过
*$("#login_form")[0].reset()*
Run Code Online (Sandbox Code Playgroud)
现在它给了
TypeError: $("#frmlogin")[0] is undefined
[Break On This Error]
$("#frmlogin")[0].reset()
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我尝试了除Amit Agrawal之外的所有代码,因为我想使用Jquery.没有炒锅.我知道我要休息的代码是提供的.我在表格中遗漏了一些东西