Here is the issue: this HTML document is invalid. It is required that each
id
attribute value should be unique in the whole HTML document. For example, please see:
http://www.w3schools.com/tags/att_global_id.asp[
^].
Even though it won't be a problem to find any nested element by some non-unique attribute value based on nesting structure, especially with jQuery, in case of
id
the problem becomes really trivial; you only need to fix HTML. I would recommend to use jQuery, which has an attribute
selector:
http://api.jquery.com/id-selector/[
^].
See also:
http://api.jquery.com/category/selectors[
^].
—SA