diff --git a/src/main/resources/org/jenkinsci/plugins/workflow/job/console/NewNodeConsoleNote/script.js b/src/main/resources/org/jenkinsci/plugins/workflow/job/console/NewNodeConsoleNote/script.js
index e489c429..19bbf5b4 100644
--- a/src/main/resources/org/jenkinsci/plugins/workflow/job/console/NewNodeConsoleNote/script.js
+++ b/src/main/resources/org/jenkinsci/plugins/workflow/job/console/NewNodeConsoleNote/script.js
@@ -14,7 +14,13 @@ Behaviour.specify("span.pipeline-new-node", 'NewNodeConsoleNote', 0, function(e)
var nodeId = e.getAttribute('nodeId')
var startId = e.getAttribute('startId')
if (startId == null || startId == nodeId) {
- e.innerHTML = e.innerHTML.replace(/.+/, '$& (hide)')
+ e.innerHTML = e.innerHTML.replace(/.+/, '$& (hide)')
+ const toggles = e.querySelectorAll('.pipeline-show-hide .pipeline-toggle');
+ const toggle = toggles[toggles.length - 1];
+ toggle.addEventListener('click', (event) => {
+ event.preventDefault();
+ showHidePipelineSection(toggle);
+ });
// TODO automatically hide second and subsequent branches: namely, in case a node has the same parent as an earlier one
}
// The CSS rule for branch names only needs to be added once per node, so we