显示/隐藏按钮,无需重新加载页面 [英] Show/Hide button without reload page
本文介绍了显示/隐藏按钮,无需重新加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个(显示/隐藏)按钮来显示这样的表格:
点击(显示):
Button (Show) changes to (Hide) and the table appears.
点击(隐藏):
Button (Hide) changes to (Show) and the table disappears.
推荐答案
<input type="button" id="button" value="hide" />
$(function(){
var button = true;
$('#button').on('click', function(){
$('#button').toggle();
if (button){
button = false;
$('#button').val('hide');
} else{
button = true;
$('#button').val('show');
}
});
})
这篇关于显示/隐藏按钮,无需重新加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文