Within a document, I can use document.getElementById()
to get a handle to a particular unique element.
How can I do the same for a group, given as a parameter.
<g id="right_hook">
<circle id="wheeltap" r="3" stroke-width="1" />
<path d="M 0 0 L 200 0 A 5,5 0 0,1 200,20" stroke-width="4" />
</g>
If I pass this group to a function:
function some( hook ) {
var tap1= hook.wheeltap; // does not work
var tap2= hook.getElementById("wheeltap); // does not work
What does?
Reason I do this is I have multiple similar objects which I want to animate in JavaScript. I can of course give each of their subobjects globally unique names (s.a. "right_hook_wheeltap
", "left_hook_wheeltap
" but that sucks).