Using Javascript on Knowledge Articles
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018 01:58 PM
Is there a good way to add Javascript for use within Knowledge articles? We are trying to use accordion drawers for our content, but it doesn't seem to be working with the Javascript on our instance. Do we need to add it as a new script for the UI page or script for kb_view?
For example:
<div class="panel group">
<a class="group-item" href="#a1" data-toggle="collapse" data-target="#a1">Group Title</a>
<div id="a1" class="collapse">
<div class="group-item">
<p>Content for Group</p>
</div>
</div>
</div>
Thanks in advance for any advice!
Labels:
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018 02:41 PM
You could include it in the kb_view UI Page like this:
<script>
There is a jQuery noConflict statement included so you would then reference the library using '$j'. Here is a test snippet I included in my kb_view to test jQuery.
<script>
$j(".caption").css("background-color","red");
</script>
Regards,
Sachin