- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

how to add html which has javascript in power bi desktop
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>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I, too, am looking for that answer.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
05-14-2024 06:23 AM | |||
11-15-2021 12:39 PM | |||
05-08-2024 11:12 AM | |||
06-21-2023 12:37 AM | |||
05-07-2024 02:06 AM |
User | Count |
---|---|
83 | |
81 | |
52 | |
37 | |
36 |
User | Count |
---|---|
104 | |
85 | |
47 | |
43 | |
42 |