gpt4 book ai didi

java - 显示隐藏的html代码的按钮?

转载 作者:太空宇宙 更新时间:2023-11-04 09:50:32 25 4
gpt4 key购买 nike

我想知道一旦用户单击 html/jsp 网站上的按钮,是否有可能在同一页面上出现某些内容?那么本质上有些文本是隐藏的,直到单击按钮然后它才会出现?我是网络开发新手,所以不确定这是否可能,谢谢

最佳答案

用于显示隐藏的 html 代码的按钮。

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<body>
<button id="showContent" >
Click Me to Show Content
</button>
<button id="hideContent" style="display:none" >
Click Me to Hide Content
</button>
<div id="hiddenId" style="display:none">Welcome Dear!</div>
</body>
<script >

$("#showContent").click(function(){
$("#hideContent").show();
$("#showContent").hide();

$("#hiddenId").show();
});
$("#hideContent").click(function(){
$("#showContent").show();
$("#hideContent").hide();
$('#hiddenId').hide();
});
</script>
</html>

关于java - 显示隐藏的html代码的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54810026/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com