我正在寻找一个(显示/隐藏)按钮来显示这样一个表:显示/隐藏按钮
点击在(显示):
Button (Show) changes to (Hide) and the table appears.
点击在(隐藏):
Button (Hide) changes to (Show) and the table disappears.
我正在寻找一个(显示/隐藏)按钮来显示这样一个表:显示/隐藏按钮
点击在(显示):
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');
}
});
})
方式放缓,但现在,我做媒体链接小提琴:
$(document).ready(function() {
$('.toggle').click(function(){
var collapse_content_selector = $(this).attr('href');
var toggle_switch = $(this);
$(collapse_content_selector).toggle(function(){
if($(this).css('display')=='none'){
toggle_switch.html('Show');
}else{
toggle_switch.html('Hide');
}
});
});
});
它也在这里工作,非常感谢你! – user3050478
非常感谢GuyT! – user3050478