使用jQuery无法进行表单重置 [英] Form Resetting is not working using jquery

查看:55
本文介绍了使用jQuery无法进行表单重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在调用ajax函数后重设表单. 这是我在jquery中给出的代码:

I want to reset the form after calling an ajax function. This is the code i gave in the jquery:

$("#frm_silder").reset();

此处frm_silder是表单的ID.但是当我使用此代码时,我收到了这样的错误消息.

Here frm_silder is the id of form. But when I'm using this code i got an eorror message like this.

$("#frm_silder").reset is not a function

在我的html中,我将ID设置为如下形式:

In my html i give the id to form like this:

<form name="frm_silder" id="frm_silder" method="post">

那我的代码有什么问题?

So what is the problem in my code?

推荐答案

在jQuery中

$('#frm_silder')[0].reset();

在Java语言中

document.getElementById('frm_silder').reset()

这篇关于使用jQuery无法进行表单重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆