Dashboards & Visualizations

Learning to include jquery in simple xml

Path Finder

Hi to all, i'm just learning to usi a little of custom jquery in splunk simple dashboard.
I have this at begining of my xml:

<form script="script.js" stylesheet="dark.css">

in script.js i have this:

 ], function($) {
    $(document).ready(function() {
        $( "#row1" ).addClass( "red" );

just a stupid code to see if it's works, but it does not.

Of cource in .css i have the class red. Even if i run in the chrome console:$( "#row1" ).addClass( "red" ); nothing happens.

Could you please help me?

Thanks and regards.

Tags (3)
0 Karma

Path Finder

Thanks to all. It works, but it seems that i need a splunkweb restart every time i modify a css or js, is it normal?
Thanks and regards

0 Karma


No, a restart isn't necessary every time. If you use the link @kurdbahr provided in the second part of his answer, it creates a new cache for JavaScript and CSS files and then you can just refresh the page.


Path Finder
0 Karma


@renjujacob88 it is actually http://<splunkURLPort>/en-US/debug/refresh. For Development or Non-prod instances, _bump, debug refresh or Development mode settings are recommended.

Following is the URL to turn on Development Mode settings with no caching: https://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/CustomVizTutorial#Development_mode_s...

| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Path Finder

As @justinatpnnl pointed out, your Javascript is probably not included in the web page because the Splunk server has not yet noticed your new Javascript file.

To make a new Javascript file available without a full server restart:

$SPLUNK_HOME/bin/splunk restartss

To force a reload of a changed Javascript file:


and click the button there to increment the version number.


Your sample code does work, so my guess is that your script isn't being seen by Splunk and isn't loading. View the page source to see if Splunk was able to find it and load it into your dashboard.

The CSS should appear in the head tag:

    <link rel="stylesheet" type="text/css" media="all" href="/en-US/static/@264376:0/app/search/dark.css" />

The JavaScript should be at the bottom of the page just before the closing of the body tag:

    <script src="/en-US/static/@264376:0/app/search/script.js" type="text/javascript"></script>

Usually in order to get my new scripts and css files to populate in a dashboard I need to restart Splunk.