Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am trying to add this below scripts which has html and javascrpt using html content visual. However the javascript part does not work. How to fix this
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<style>
/* CSS code goes here */
#welcome {
color: blue;
cursor: pointer;
}
#welcome.clicked {
color: red;
}
</style>
<script>
// JavaScript code goes here
window.addEventListener('DOMContentLoaded', () => {
const welcome = document.getElementById('welcome');
welcome.addEventListener('click', () => {
welcome.classList.toggle('clicked');
});
});
</script>
</head>
<body>
<!-- HTML code goes here -->
<h1 id="welcome">Welcome</h1>
</body>
</html>
You must ensure that all quotes in your HTML code are single quotes ' and never double quotes ". This is because the measure will not interpret double quotes correctly. By making this change, your code should work as expected.
I, too, am looking for that answer.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
71 | |
57 | |
38 | |
36 |
User | Count |
---|---|
81 | |
67 | |
62 | |
46 | |
45 |