Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have tried $("#client.frm").reset();

(我试过$("#client.frm").reset();)

but it is not working.So how to reset form via jQuery?

(但是它不起作用。那么如何通过jQuery重置表单?)

  ask by translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
411 views
Welcome To Ask or Share your Answers For Others

1 Answer

form.reset() is a DOM element method (not one on the jQuery object), so you need:

(form.reset()是DOM元素方法(jQuery对象上没有),因此您需要:)

$("#client.frm")[0].reset();
//faster version:
$("#client")[0].reset();

Or without jQuery:

(还是没有jQuery:)

document.getElementById("client").reset();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...