The question to select a custom tag is asked many times.
<div mytag="foo"></div>
would be $('[mytag]')
or $('div[mytag]')
.
Now my question is about the fact that the above isn't valid HTML5.
This however would be valid: <div data-mytag="foo"></div>
.
Now my assumption was that -if I offer the user to use mytag="foo"
or data-mytag="foo"
- I could do this: $('[$mytag]')
. Where $ = everything that is prefixed mytag.
Why is this wrong and how could I resolve this?
PS:
Currently I'm doing: $('[mytag], [data-mytag]')
which looks design-flawish...