I have two elements with the following setup:
<span data-placeholder-class="test-class"></span>
<span data-placeholder-template="/some/template.hbs"></span>
I'm using underscore to loop over any elements containing either of these attributes and then performing relevant actions if they do.
Currently this is done like so
_.each($('[data-placeholder-class], [data-placeholder-template]'), function cb(element) {
// code goes here
})
Rather than have to define each data attribute to loop over I wondered if there was a way I could select all attributes that contain a common keyword, in this case placeholder. e.g.
_.each($('[data-placeholder-*]'), function cb(element) {
// code goes here
})
Anyone know if this is possible at all?