Search code examples
htmlmarkupcustom-attributes

HTML - tag name as attribute - is valid and how to use?


Is such html markup valid?

<icon="pen"/>

And if so, how to manage it like via jQuery?


Solution

  • No, it is not valid. Don't do that.

    There is a proposal for a custom elements spec, which could make icon allowable.

    But following the element name with an = character is simply wrong.