I want to trigger a click event while changing the event target item. jQuery solution is not mandatory.
The regular triggering works while the custom one doesn't.
This regular example works:
$(tab).trigger('click');
this one, on the other hand, doesn't:
let event = $.Event('click');
event.target = otherTab;
$(tab).trigger(event);
Am I missing anything?
Edit (tried the vanilla way):
let e = new Event('click'); // tab and otherTab are jQuery objects
e.target = otherTab[0];
tab[0].dispatchEvent(e);
Which is triggered but the e.target is not set and still null.