can't we access this parentNode.parendNode with another way (an id maybe) ? This is too close to the DOM tree for me.

if we keep that here, it would be better to cache inputs[i].