so if someone clicks on a link like (excuse the jade):
div
ul
li
a(href="/foo") Bar
li
a(href="/baz") Foo
Say i click on the link that says "Bar"
how can i programmatically find the clicked node in the DOM
? I can use a heuristic like tagName + innerHtml
or something but does the DOM
itself must have some way of identifying elements that i can use to query later on with normal javascript/jquery?
EDIT: Please We have to assume that we don't a priori know anything about what was clicked but we do have an event object after the click happens. Is there an event.target.something
that is unique? and can i then say (in jquery) $(event.target.something)
and correctly select the right element?