Create Dashboard Widget *New Static HTML Content Block and Create Collapsible Sections Within
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 03:56 PM
Is there any way on a Dashboard Widget *New Static HTML Content Block and Within Create Collapsible Sections? I am following W3Schools Tryit Editor, but I just cannot get it to work with SN (Xanadu) and am not sure what the issue may be. Anyone have any ideas?
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.collapsible {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #555;
}
.content {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #f1f1f1;
}
</style>
</head>
<body>
<p><button type="button" class="collapsible">Option 1</button></p>
<div class="content">
<p>Option 1 Text here</p>
</div>
<p><button type="button" class="collapsible">Option 2</button></p>
<div class="content">
<p>Option 2 Text Here</p>
</div>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
</script>
</body>
</html>