I have declared a aui-toggle element in my soy file
<aui-toggle id="date-type-select" label="Date Type"></aui-toggle>
and in my js I retrieve the toggle object
var $toggle = $(".date-type-select", $form);
I tried using “document.getElementById” as mentioned in the AUI document pages but that would not work (null).
I then attempted to add a listener also as shown in the official docs:
But this throws a “.addEventlistener is not a function”. So instead I uses .click which does work.
Why is this? Why do the docs say to use “.addEventListener”? And their codepen example works!