When logic related to events like onClick
, onHover
, onChange
etc. needs to be evaluated, we can use <domtestevents>
1. <event>
Code present in <event>
will be executed separately on both user code and solution code. After that, the final result will be compared and used for evaluation.
2. Usage
<domtestevents>
<event>
document.getElementById('button').click();
</event>
</domtestevents>
In the above code snippet, we are adding an event to click the element with id as button
. This will ensure the button will be clicked and the onClick action of that button will be performed before evaluation.