# Javascript on working in Text Panel in Grafana 7.1

**URL:** <https://community.grafana.com/t/javascript-on-working-in-text-panel-in-grafana-7-1/33900>\
**Category:** Grafana\
**Created:** [July 20, 2020, 3:15pm UTC](https://community.grafana.com/t/javascript-on-working-in-text-panel-in-grafana-7-1/33900 "2020-07-20T15:15:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dassambuddha](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@dassambuddha](https://community.grafana.com/u/dassambuddha)\
**Post date:** [July 20, 2020, 3:15pm UTC](https://community.grafana.com/t/javascript-on-working-in-text-panel-in-grafana-7-1/33900/1 "2020-07-20T15:15:10Z")

</div>

After upgrading to Grafana 7.1.0 from Grafna 7.0.6, the script in Text panel stopped working.

Configuration in custom.ini  
[panels]  
enable\_alpha = true  
disable\_sanitize\_html = true

Here is what I have in Text Panel

```
<div style="width: 100%; font-size: 22px; font-weight: 500; text-align: right;" id="time_range_info"></div>

<div style="width: 100%; font-size: 100%; text-align: right;" id="time_range_text"></div>

<script>

function getDashboardTimeRange(){

   var dateFormat = "ll";

   var tr = angular.element('grafana-app').injector().get('timeSrv').timeRange();

   return ["<img src='/public/stealth/calendar.png'/>&nbsp;&nbsp;", tr.from.format(dateFormat), ' - ', tr.to.format(dateFormat)].join('');

}

function textFill(){

   $('#time_range_info').html(getDashboardTimeRange());

   $('#time_range_text').html($("button[aria-label='TimePicker Open Button'] > span.css-1cvxpvr > span").html());

}

angular.element('grafana-app').injector().get('dashboardSrv').getCurrent().events.on('refresh', function () {textFill()});

textFill();

</script>
```

---

<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:** [June 15, 2021, 10:05pm UTC](https://community.grafana.com/t/javascript-on-working-in-text-panel-in-grafana-7-1/33900/2 "2021-06-15T22:05:15Z")

</div>

Hi @dassambuddha

This should be working now:

> [@How to add HTML Code in Grafana 7](https://community.grafana.com/t/how-to-add-html-code-in-grafana-7/47503/2):
>
> Hi @barryaljawari This still works. Here is your html code on my local instance running Grafana 8.0.2: There was a lot of [work done on the Text Panel](https://github.com/grafana/grafana/pull/26413) between Grafana 6 and 7. Have you set disable\_sanitize\_html to true in your configurations? You need to do that starting with v7: docker run -d -p 3000:3000 "GF\_PANELS\_DISABLE\_SANITIZE\_HTML=true" grafana/grafana:8.0.2 NOTE: The default is false because this setting leaves you more exposed to XSS atta…
