guys. I’m developing a jQuery plugin that wraps an element inside a container. So, this line:
$azureRectangle.container(); //azureRectangle is only an empty div
Produces this:

The container is composed with many new divs. Well, here is my doubt: How should I name or identify those created divs? Should I use a data attribute or an invented id or name?
Well, there are several policies for that. You certainly can use either ‘data’ or ‘rev’ attributes, but then you might have difficulties when trying to select a specific container element.
Usually, though, wrapper (and replacer) plugins work with elements with
idattribute set, so they can generate a correspondingidfor the elements they create. For example:This allows both grapping all items (with
'[id^="some-plugin-"]'selector) and each specific one (having anidof element which was involved in its creation).The same policy, of course, can be applied when more then one new element should be created; you just have to use several specific prefixes for these.