问题描述
我需要在单击按钮时显示和隐藏弹出窗口。
这就是我现在拥有的:
jQuery(document).ready(function(){
jQuery('#knop-popup1').click(function() {
jQuery('#popup1').toggleClass('show');
jQuery('#popup2').toggleClass('hidden');
});
});
</script>
<script>
jQuery(document).ready(function(){
jQuery('#knop-popup2').click(function() {
jQuery('#popup2').toggleClass('show');
jQuery('#popup1').toggleClass('hidden');
});
});
我需要的是单击按钮1时popup1正在打开。 然后,当单击按钮2时,popup1正在关闭,popup2正在显示。
不幸的是,这不起作用。 有人可以帮我吗?
伊冯娜
解决方法
这是一个基本示例,显示了当用户单击不同的按钮时如何隐藏/显示不同的元素。
chart.dispatchAction({
type: 'highlight',dataIndex: your_index,});
$("#showOne").on('click',() => {
$("#one").attr("class","");
$("#two").attr("class","hide");
})
$("#showTwo").on('click',() => {
$("#two").attr("class","");
$("#one").attr("class","hide");
})
.hide {
display: none;
}