I know there are .on and .live (deprecated) available from JQuery, but it is assumed that you want to attach event handlers to one or more events of a dynamically added element that I donβt have. I just need to reference it so that I can access some of its attributes.
And, more specifically, there are many dynamic elements, such as everything, with a set of class="cluster" and each with a different value for the title attribute, top attribute and left attribute.
None of these jquery options work:
var allClusters = $('.cluster'); var allClusters2 = $('#map').children('.cluster'); var allClusters3 = $('#map').find('.cluster');
Again, I don't want to attach any event handlers, so .on doesn't seem to be the right solution, even if I have to capture it, add a dummy event, doNothing handler, and then just specify my attributes.
There must be a better solution. Any ideas?
UPDATE:
I didnβt formulate the title correctly, because I wanted to say that the elements were dynamically added to the DOM, but not through jQuery. Title updated.
source share