Is it possible to create custom tag like p or h1 in html5? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to create custom tag like p or h1 in html5?

12th Apr 2018, 7:04 AM
shiva stha
shiva stha - avatar
3 Answers
+ 8
Since html is based on xml, yes. you are free to do : <custom>123</custom> and grab it in js too like document.getElementByTagName('custom')[0] but might throw annoying console warnings if not registered through javascript code...
12th Apr 2018, 8:04 AM
Valen.H. ~
Valen.H. ~ - avatar
0
Just to save you future frustration I had. To access the property values of a custom tag you need to use .getAttribute("name")
13th Apr 2018, 10:07 PM
Private [GER]
Private [GER] - avatar