peerlibrary / meteor-blaze-components

Reusable components for Blaze
http://components.meteorapp.com/
BSD 3-Clause "New" or "Revised" License
354 stars 26 forks source link

Rendered content selector scope? #106

Closed JesperWe closed 9 years ago

JesperWe commented 9 years ago

The documentation section on Access to Rendered Content says:

The component serves as the document root for the selector. Only elements inside the component and its sub-components can match parts of the selector.

I am having trouble with this when I have two copies of a component instantiated on the same page. A $("#foo") selector in an event handler in the second instance gives me the element from the first. Have I not understood this correctly?

JesperWe commented 9 years ago

OK, now I have understood :-)
I have realized all the documented stuff is relative to this, so need this.$(), not $()

mitar commented 9 years ago

Yes. And also have in mind that IDs have to be unique on the page. So #foo should always match only one element anyway.