All Apps and Add-ons

Including JQuery/Javascript and CSS in HTML sideview utils module

watsm10
Communicator

Hi Splunkers,

I've got the latest version of Sideview Utils and am making use of the HTML module to include the results from my splunk search inside an HTML table.

What I'm trying to do is add a javascript + CSS element to it so that the colour of the a single cell changes colour depending on what value is inside the td element in the table.

I have got the javascript and CSS working correctly on jsfiddle.net, but as soon as I copy and paste into the HTML module on Splunk, the search results don't load in my dashboard and nothing else loads properly.

Has anyone got any idea of how I can get this to work?

Thanks!

sideview
SplunkTrust
SplunkTrust

You're probably better off using the rendering or even the embedding features of the Table module, rather than trying to go the other way and use the HTML module to make a table.

However, speaking just in the context of using the HTML module to generate Javascript and CSS,

a) it could possibly be a XML syntax problem - are you escaping the "html" param's contents correctly, preferably by putting it in a CDATA block? If nothing loads properly it sounds like a wrench has been thrown into a relatively low level like this.

b) are there any Javascript errors evident in Tools > Error Console, or the equivalent in your browser? If so can you add them to your question above?

c) be aware that whenever a push hits an HTML module, the HTML module re-renders it's HTML. This can have unwanted effects when the HTML module is embedding javascript, as runtime values can be unexpectedly clobbered as they get reinitialized. Sometimes a simple solution is to put the script safely upstream at a point that will never receive any "push", and keep the dynamic html parts in another HTML module further downstream.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Mile High Learning with Splunk University, Denver, Colorado

If Denver is known for its mile-high elevation, Splunk University is about to raise the bar on technical ...

IT Service Intelligence 5.0 Series: Your Guide to the June Launch

We are excited to announce the June release of Splunk IT Service Intelligence (ITSI) 5.0. This update ...

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...