清除Bootstrap中的表单输入字段? [英] Clearing form input fields in Bootstrap?
本文介绍了清除Bootstrap中的表单输入字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Bootstrap是否提供任何用于通过按钮清除表单输入字段的内容?
Does Bootstrap offer anything for clearing form input fields via a button?
还是我需要通过jquery自己滚动?
Or do I need to roll my own through jquery?
从这篇文章中 jQuery Validate resetForm()不会重置onFocus验证,似乎有一个来自jQuery的resetForm()方法,但是当我尝试访问该方法时,总是得到一个不支持该方法的对象.
From this post jQuery Validate resetForm() doesn't reset the onFocus validation, there seems to be a resetForm() method coming from jquery but I always get a object doesn't support method when I try to access that method.
推荐答案
您可以使用重置方法(这是DOM元素方法,它不是jQuery对象方法),就像这样
You can use reset method (this is DOM element method, it is not jQuery object method), like this
$('form').get(0).reset() // or $('form')[0].reset()
这篇关于清除Bootstrap中的表单输入字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文