清除或复位按钮 [英] Clear or Reset Button
本文介绍了清除或复位按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表格和工作复位按钮。当我点击按钮,所有的输入和文本区域框是清楚的。我在想,如果有创造一个透明/重置按钮,将只清除某些输入,而不是什么我有我的文本区域框内的一种方式。
I have a form and a working reset button. When i click the button all inputs and text area boxes are clear. I was wondering if there's a way to create a clear/reset button that will clear only some inputs and not what i have inside my text area box.
推荐答案
这里的的jsfiddle 解决方案。
<form>
<input type="text" class="clearit" /><br />
<input type="text" class="clearit" /><br />
<input type="text" class="clearit" /><br />
<textarea id="t5"></textarea><br />
<input type="reset" id="reset" />
</form>
$(document).ready(function(){
$('#reset').on('click',function(e){
e.preventDefault();
$('.clearit').val("");
});
});
这篇关于清除或复位按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文