I have two elements with the following setting:
<span data-placeholder-class="test-class"></span> <span data-placeholder-template="/some/template.hbs"></span>
I use underscore to iterate over all elements containing any of these attributes, and then perform the appropriate actions if they do.
This is currently being done like this
_.each($('[data-placeholder-class], [data-placeholder-template]'), function cb(element) {
Instead of defining each data attribute for the loop, I wondered if there was a way to select all attributes that contain a common keyword, in this case a placeholder. eg.
_.each($('[data-placeholder-*]'), function cb(element) {
Does anyone know if this is possible at all?
javascript jquery html5 custom-data-attribute
woolm110
source share