如果单击按钮,则使用Jquery隐藏/取消隐藏文本框 [英] Using Jquery to hide/unhide the textbox if button is clicked
本文介绍了如果单击按钮,则使用Jquery隐藏/取消隐藏文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有输入按钮,我想要的是,如果用户单击按钮,则应显示文本框.
I have input button , what I want is if a user clicks on the button then textbox should appear.
下面是无效的代码:
<input type="submit" value="Add Second Driver" id="driver" />
<input type="text" id="text" />
$("#driver").click(function() {
$('#text').show();
}
});
该文本框最初也不应该显示
Also the textbox should not be visible initially
推荐答案
尝试一下:
$(document).ready(function(){
$("#driver").click(function(){
$("#text").slideToggle("slow");
});
});
这篇关于如果单击按钮,则使用Jquery隐藏/取消隐藏文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文