The very common statement var someElement = document.getElementById('some-name');

gives one the variable/pointer to the element called 'some-name'.

But what if you need the reverse, namely: if you have some variable that's an element, how do you find its name?

Ah, using .id is working now. I had an odd bug using a function I defined called id(name) = { return document.getElementById(name); }

0 Answers