samedi 27 juin 2020

Is it possible in HTML to create an ALIAS for common tags with common attributes?

What I am looking into is to improve semantics. I wonder if I can reduce the amount of TAG attributes into a set of TAGs which would function as ALIASes.

For example, the tipical hidable control using checkbox is:

<label for="toggle">Do Something</label>
<input type="checkbox" id="toggle">
<div class="control-me">Control me</div>

I would like to use in a table, where a sub-grouping title is able to hide some rows: https://jsfiddle.net/diegoj2020/adfpt8n2/6/

What I would like to get the html is something like next code, where the input, the label, the class, style, type and id attributes are saved from the semantics

<tooglecontrol>Do Something<tooglecontrol>
<div class="control-me">Control me</div>

For creating new TAGs I have read an understand this other question, but I couldn't figure it out how to replace an INPUT element, in other words, how to make tooglecontrol to show and behave like a checkbox.

Is there a way to create your own html tag in HTML5?




Aucun commentaire:

Enregistrer un commentaire