Getting objects referred to by other objects

Getting objects referred to by other objects

I have a puzzle I am unable to crack.

I am using a custom HTML attribute with the value being the ID of another tag on the page.

I would like to get a JQuery set of all of the tags referred to that way by any tags on the page.

For example, lets say I have:
  1. <h1 id="bob">some header</h1>
  2. <p id="larry">some text</p>
  3. <p myAttr="bob">...</p>
  4. <p myAttr="larry">...</p>
  5. <input type="Submit" myAttr="bob" />
I want to get a query containing all tags with an id equal to the value of any other tag's myAttr, without duplicates.

Any ideas?

Jacob