Hm! It just tried it, it's true!
My idea was to try jQuery. As I thought, the equivalent solution with jQuery worked correctly:
I don't see initialization of the variables
in your code but assumed they are objects correctly representing DOM elements, so they could serve as valid parameters to the jQuery
function, which can also accept different types of parameters (selectors using IDs, classes, XPath queries and the combinations of those) and return jQuery wrapper objects representing a set of DOM elements, with a number of functions.