This is a jQuery quirk, which surprised me when I first saw it too! jQuery’s
trigger('click') is only triggering a click on the jQuery-wrapped element, as opposed to the underlying DOM element, which is what our script is expecting. I’m not sure why it’s jQuery’s behaviour to run the
onclick handler, but not pass the click event down to the DOM element, but I guess that’s just how the library is. Some more details here: https://stackoverflow.com/questions/20928915/jquery-triggerclick-not-working
If we rewrite the first link’s click handler to fire the event using plain JS, it will work:
window.ubtrigger = () => document.querySelector('#triggerme').click();. You should be able to just run that in the console on your page and then see the first link working as expected. Alternately, you can select the element via jQuery and then get the DOM element from the jQuery object:
Hope it works out for you! I’ll pass on your feature request.
PS: Your test page was really clear, thanks for that!