<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Why is my javascript code not working in my dashboard? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314397#M20149</link>
    <description>&lt;P&gt;So, I am trying to get a progress bar button in Splunk Dashboard, which will work on click button. &lt;BR /&gt;
Here  is what i done :&lt;/P&gt;

&lt;P&gt;I have created a 2 files under /opt/splunk/etc/apps/MY_APP/appserver/static/button.js  and button.css&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;code for button.js is :

*****************************************************
function move() {
  var elem = document.getElementById("myBar");   
  var width = 1;
  var id = setInterval(frame, 10);
  function frame() {
    if (width &amp;gt;= 100) {
      clearInterval(id);
    } else {
      width++; 
      elem.style.width = width + '%'; 
    }
  }
}
*****************************************

Code for prog.css is :
******************************************
#myProgress {
  width: 100%;
  background-color: #ddd;
}

#myBar {
  width: 1%;
  height: 30px;
  background-color: #4CAF50;
}

************************************************
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now here is my code for Dashboard where i can calling button.css and button.js file ( button.css works fine)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  testdash

    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;




Click Me 





***********************************************
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;please find an Image below for your reference .&lt;/P&gt;

&lt;P&gt;Button.js is still not working. &lt;/P&gt;

&lt;P&gt;Any suggestion ?&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2516iD4098517AE2E0044/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 16:02:37 GMT</pubDate>
    <dc:creator>mrao123</dc:creator>
    <dc:date>2017-02-22T16:02:37Z</dc:date>
    <item>
      <title>Why is my javascript code not working in my dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314397#M20149</link>
      <description>&lt;P&gt;So, I am trying to get a progress bar button in Splunk Dashboard, which will work on click button. &lt;BR /&gt;
Here  is what i done :&lt;/P&gt;

&lt;P&gt;I have created a 2 files under /opt/splunk/etc/apps/MY_APP/appserver/static/button.js  and button.css&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;code for button.js is :

*****************************************************
function move() {
  var elem = document.getElementById("myBar");   
  var width = 1;
  var id = setInterval(frame, 10);
  function frame() {
    if (width &amp;gt;= 100) {
      clearInterval(id);
    } else {
      width++; 
      elem.style.width = width + '%'; 
    }
  }
}
*****************************************

Code for prog.css is :
******************************************
#myProgress {
  width: 100%;
  background-color: #ddd;
}

#myBar {
  width: 1%;
  height: 30px;
  background-color: #4CAF50;
}

************************************************
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now here is my code for Dashboard where i can calling button.css and button.js file ( button.css works fine)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  testdash

    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;




Click Me 





***********************************************
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;please find an Image below for your reference .&lt;/P&gt;

&lt;P&gt;Button.js is still not working. &lt;/P&gt;

&lt;P&gt;Any suggestion ?&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2516iD4098517AE2E0044/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 16:02:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314397#M20149</guid>
      <dc:creator>mrao123</dc:creator>
      <dc:date>2017-02-22T16:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my javascript code not working in my dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314398#M20150</link>
      <description>&lt;P&gt;I fixed it of my own .. &lt;/P&gt;

&lt;P&gt;Ans : by clearing the browser cache..&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 17:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314398#M20150</guid>
      <dc:creator>mrao123</dc:creator>
      <dc:date>2017-02-22T17:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my javascript code not working in my dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314399#M20151</link>
      <description>&lt;P&gt;In most cases you can use the _bump url to bust the cache for you&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="https://&amp;lt;yourSplunk&amp;gt;/en-US/_bump" target="test_blank"&gt;https://&amp;lt;yourSplunk&amp;gt;/en-US/_bump&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Give it a try next time you update your js&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 19:37:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-is-my-javascript-code-not-working-in-my-dashboard/m-p/314399#M20151</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-02-22T19:37:51Z</dc:date>
    </item>
  </channel>
</rss>

