[英]Using JavaScript to Trigger Div on Page w/ Certain Body Class On Button Click
Let's say I have a page with: 假设我有一个页面:
<body class="Test">
And I have a button on the page as follows: 我在页面上有一个按钮,如下所示:
<div id="FinishButton">
And then I have a div on the page as below: 然后我在页面上有一个div,如下所示:
<div class="slide-1">
And then I have a hidden div as follows: 然后我有一个隐藏的div,如下所示:
<div class="slide-2">
How can I use JavaScript to make slide-2 appear and slide-1 disappear when I click that button ONLY on a page with the body class of "Test"? 当仅在主体类为“测试”的页面上单击该按钮时,如何使用JavaScript使slide-2出现而slide-1消失?
Thanks! 谢谢!
$('.Test'>'#FinishButton').click(function(){
$('.slide-1').hide();
$('.slide-2').show();
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.