# Javascript embedded works in text panel but doesnt work in html panel

**URL:** <https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266>\
**Category:** Grafana\
**Tags:** html-panel, plugins\
**Created:** [February 4, 2022, 7:57pm UTC](https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266 "2022-02-04T19:57:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco67](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@marco67](https://community.grafana.com/u/marco67)\
**Post date:** [February 4, 2022, 7:57pm UTC](https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266/1 "2022-02-04T19:57:23Z")

</div>

Hello. I am using Grafana 8.0.1,and I am trying some tests with the html panel ([HTML plugin for Grafana | Grafana Labs](https://grafana.com/grafana/plugins/aidanmountford-html-panel/)), and I want to create an horizontal tree view, with images, capable to expand/retract the differents levels (father/childs) in this tree view.  
The value of the metrics could change the color or shape of the images in the tree view.  
I found code in the web and adapted it to my needs.  
The code doesnt work in html panel, remains like a static picture, but in text panel the code works. Unfortunaly, the text panel foesnt accept metrics as data, so is no useful to me.  
this is look in html panel

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/1/3/13be20afcd8d94650f17e17b234f763795e30a9a.png)

this is look in text panel  
 ![text panel](https://us1.discourse-cdn.com/grafana/original/3X/6/d/6d42380abd620c3cf5d78fc948e657da01045fe0.png)

is there a way to achieve that html panel accept javascript embedded in the “html” section ??

This is the full code

```auto
<!DOCTYPE html>
<html>
    <head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function () {
    $('.genealogy-tree ul').hide();
    $('.genealogy-tree>ul').show();
    $('.genealogy-tree ul.active').show();
    $('.genealogy-tree li').on('click', function (e) {
        var children = $(this).find('> ul');
        if (children.is(":visible")) children.hide('fast').removeClass('active');
        else children.show('fast').addClass('active');
        e.stopPropagation();
    });
});
</script>      
<style>
    /*----------------genealogy-scroll----------*/

.genealogy-scroll::-webkit-scrollbar {
    width: 5px;
    height: 8px;
}
.genealogy-scroll::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: #e4e4e4;
}
.genealogy-scroll::-webkit-scrollbar-thumb {
    background: #212121;
    border-radius: 10px;
    transition: 0.5s;
}
.genealogy-scroll::-webkit-scrollbar-thumb:hover {
    background: #d5b14c;
    transition: 0.5s;
}

/*----------------genealogy-tree----------*/
.genealogy-body{
    white-space: nowrap;
    overflow-y: hidden;
    padding: 50px;
    min-height: 500px;
    padding-top: 10px;
}
.genealogy-tree ul {
    padding-top: 20px; 
    position: relative;
    padding-left: 0px;
    display: flex;
}
.genealogy-tree li {
    float: left; text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
}
.genealogy-tree li::before, .genealogy-tree li::after{
    content: '';
    position: absolute; 
  top: 0; 
  right: 50%;
    border-top: 2px solid #ccc;
    width: 50%; 
  height: 18px;
}
.genealogy-tree li::after{
    right: auto; left: 50%;
    border-left: 2px solid #ccc;
}
.genealogy-tree li:only-child::after, .genealogy-tree li:only-child::before {
    display: none;
}
.genealogy-tree li:only-child{ 
    padding-top: 0;
}
.genealogy-tree li:first-child::before, .genealogy-tree li:last-child::after{
    border: 0 none;
}
.genealogy-tree li:last-child::before{
    border-right: 2px solid #ccc;
    border-radius: 0 5px 0 0;
    -webkit-border-radius: 0 5px 0 0;
    -moz-border-radius: 0 5px 0 0;
}
.genealogy-tree li:first-child::after{
    border-radius: 5px 0 0 0;
    -webkit-border-radius: 5px 0 0 0;
    -moz-border-radius: 5px 0 0 0;
}
.genealogy-tree ul ul::before{
    content: '';
    position: absolute; top: 0; left: 50%;
    border-left: 2px solid #ccc;
    width: 0; height: 20px;
}
.genealogy-tree li a{
    text-decoration: none;
    color: #666;
    font-family: arial, verdana, tahoma;
    font-size: 11px;
    display: inline-block;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
}

.genealogy-tree li a:hover+ul li::after, 
.genealogy-tree li a:hover+ul li::before, 
.genealogy-tree li a:hover+ul::before, 
.genealogy-tree li a:hover+ul ul::before{
    border-color: #fbba00;
}

/*--------------memeber-card-design----------*/
.member-view-box{
    padding:0px 20px;
    text-align: center;
    border-radius: 4px;
    position: relative;
}
.member-image{
    width: 60px;
    position: relative;
}
.member-image img{
    width: 60px;
    height: 60px;
    border-radius: 6px;
  background-color :#fff;
  z-index: 1;
}
    </style>
</head>
<body>
<div class="body genealogy-body genealogy-scroll">
    <div class="genealogy-tree">
        <ul>
            <li>
                <a href="javascript:void(0);">
                    <div class="member-view-box">
                        <div class="member-image">
                            <img src="https://www.svgrepo.com/show/190391/bank.svg" alt="KK">
                            <div class="member-details">
                                <h3>Cliente</h3>
                            </div>
                        </div>
                    </div>
                </a>
                <ul class="active">
                    <li>
                        <a href="javascript:void(0);">
                            <div class="member-view-box">
                                <div class="member-image">
                                    <img src="https://www.svgrepo.com/show/227735/servers-server.svg" alt="qqqq">
                                    <div class="member-details">
                                        <h3>Servidores</h3>
                                    </div>
                                </div>
                            </div>
                        </a>
                        <ul >
                            <li>
                                <a href="javascript:void(0);">
                                    <div class="member-view-box">
                                        <div class="member-image">
                                            <img src="https://www.svgrepo.com/show/354004/linux-tux.svg" alt="Member">
                                            <div class="member-details">
                                                <h6>Servers Linux</h6>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                            </li>
                            <li>
                                <a href="javascript:void(0);">
                                    <div class="member-view-box">
                                        <div class="member-image">
                                            <img src="https://www.svgrepo.com/show/355384/windows-legacy.svg" alt="Member">
                                            <div class="member-details">
                                                <h7>Servers Windows</h7>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                                <ul>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/355384/windows-legacy.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Windows1</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/355384/windows-legacy.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Windows2</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/355384/windows-legacy.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Windows3</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                </ul>
                            </li>
                             <li>
                                <a href="javascript:void(0);">
                                    <div class="member-view-box">
                                        <div class="member-image">
                                            <img src="https://www.svgrepo.com/show/138912/database.svg" alt="Member">
                                            <div class="member-details">
                                                <h7>Servers Base Datos</h7>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                                <ul>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/331738/mysql-database.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Server Mysql</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/355152/oracle.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Oracle servers</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                        <ul>
                                            <li>
                                                <a href="javascript:void(0);">
                                                    <div class="member-view-box">
                                                        <div class="member-image">
                                                            <img src="https://www.svgrepo.com/show/355152/oracle.svg" alt="Member">
                                                            <div class="member-details">
                                                                <h6>Oracle1</h6>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="javascript:void(0);">
                                                    <div class="member-view-box">
                                                        <div class="member-image">
                                                            <img src="https://www.svgrepo.com/show/355152/oracle.svg" alt="Member">
                                                            <div class="member-details">
                                                                <h6>Oracle2</h6>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </a>
                                            </li>
                                         </ul>
                                    </li>
                                   
                                </ul>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:void(0);">
                            <div class="member-view-box">
                                <div class="member-image">
                                    <img src="https://www.svgrepo.com/show/278279/networking-computer.svg" alt="Member">
                                    <div class="member-details">
                                        <h3>Network</h3>
                                    </div>
                                </div>
                            </div>
                        </a>
                        <ul class="active">
                            <li>
                                <a href="javascript:void(0);">
                                    <div class="member-view-box">
                                        <div class="member-image">
                                            <img src="https://www.svgrepo.com/show/849/telephone.svg" alt="Member">
                                            <div class="member-details">
                                                <h6>Voz</h6>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                              <ul>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/15439/phone-call.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Call Manager</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="https://www.svgrepo.com/show/337420/voicemail.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Voice Mail</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="/public/img/gateway.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Gateway</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                </ul>
                            </li>
                            <li>
                                <a href="javascript:void(0);">
                                    <div class="member-view-box">
                                        <div class="member-image">
                                            <img src="/public/img/network.svg" alt="Member">
                                            <div class="member-details">
                                                <h6>Datos</h6>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                                <ul>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="/public/img/router.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Routers</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="/public/img/switchL3.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>Switch L3</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="javascript:void(0);">
                                            <div class="member-view-box">
                                                <div class="member-image">
                                                    <img src="/public/img/wifi.svg" alt="Member">
                                                    <div class="member-details">
                                                        <h6>WiFi</h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </a>
                                    </li>
                                </ul>
                            </li>
                           
                        </ul>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</div>

</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![anon70503803](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@anon70503803](https://community.grafana.com/u/anon70503803)\
**Post date:** [February 9, 2022, 2:30am UTC](https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266/2 "2022-02-09T02:30:02Z")

</div>

Have you tried adjusting this configuration setting to allow unsanitized HTML in text panels?

> **[Configuration](https://grafana.com/docs/grafana/latest/administration/configuration/#disable_sanitize_html)**
>
> Configuration documentation

---

<div class="post-metadata">

**Author:** ![marco67](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@marco67](https://community.grafana.com/u/marco67)\
**Post date:** [February 9, 2022, 2:57pm UTC](https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266/3 "2022-02-09T14:57:19Z")

</div>

Hello. Yes, that configuration already is running

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/c/8/c82f1791d95d661530549421391a6671de6a0369.png)

Text panel is working fine, but the same javascript doesnt work in html panel. That is my problem.

---

<div class="post-metadata">

**Author:** ![jangaraj](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jangaraj/32/39197_2.png) [@jangaraj](https://community.grafana.com/u/jangaraj)\
**Post date:** [February 9, 2022, 3:36pm UTC](https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266/4 "2022-02-09T15:36:13Z")

</div>

That HTML panel is quite old plugin - it was developed and tested with Grafana 3, so I can imagine that’s not updated for the latest Grafana version.

As you see [https://github.com/aidanmountford/aidanmountford-html-panel/issues](https://github.com/aidanmountford/aidanmountford-html-panel/issues) it has a quite many and old issues, so it is not maintained properly. That’s a problem of many third party plugins. I would use Grafana labs maintained plugins, when it’s possible.

---

<div class="post-metadata">

**Author:** ![marco67](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@marco67](https://community.grafana.com/u/marco67)\
**Post date:** [February 9, 2022, 3:46pm UTC](https://community.grafana.com/t/javascript-embedded-works-in-text-panel-but-doesnt-work-in-html-panel/60266/5 "2022-02-09T15:46:18Z")

</div>

Yes, maybe that is the reason that this panel doesnt work. Sadly it seems that there is not a similar plugin maintained by Grafana Labs
