Skip to main content
Known Participant
October 19, 2015
Question

Running custom JS code when filter is selected - where to start?

  • October 19, 2015
  • 1 reply
  • 360 views

Hi there,

I want to add custom JS code that is executed each time the user selects a filter in the filter pane (RH 2015, HTML5 output). Unfortunately, most of the code dealing with the filter pane is minified (common.min.js and rh.min.js). 

Has anyone tried this before? Is there a suitable "entry point" to add custom event code for this? (Tried OnPageClick in ehlpdhtm.js, but that doesn't seem to work since the event.target doesn't change after the first click event for the filter pane is fired).

This topic has been closed for replies.

1 reply

Inspiring
September 20, 2018

Although this is a rather old question and the OP probably found an alternate solution by now, I'd like to offer my approach for doing this when using a HTML5 layout (from RH 2015 upward).

I have added an "onClick" attribute to the filter item <input> tags in the template's topic.slp (and homepage.slp if available) files. The onClick attribute can then call a custom JS function, with a delay if needed in order to wait until the filter change is actually applied.

This means you need to adapt the Robohelp template, which can be complicated.