Javascript on working in Text Panel in Grafana 7.1

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

Configuration in custom.ini
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>


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), ' - ',].join('');


function textFill(){


   $('#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()});



Hi @dassambuddha

This should be working now: