Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How to create custom HTML tags?

user-image
Question ajoutée par Utilisateur supprimé
Date de publication: 2014/09/20
Muhammad Waqas
par Muhammad Waqas , C#/.Net Developer , Signup solution

Custom elements are created using document.registerElement():

Example:

var myFoo=document.registerElement('my-Foo')

document.body.appendChild(new myFoo());

 

The first argument to document.registerElement() is the element's tag name. The name must contain a dash (-). So for example, <x-tags><my-element>, and <my-awesome-app> are all valid names, while <tabs> and <foo_bar> are not. This restriction allows the parser to distinguish custom elements from regular elements but also ensures forward compatibility when new tags are added to HTML.

 

Mahmoud Elmahdi
par Mahmoud Elmahdi , UX/UI Designer, Web Developer , ikantam.com

If you're looking to create your own tag, then there's several ways to do it!* Polymer by Google https://www.polymer-project.org/

* Pure js as ( as showing in the prev answer )

* Angularjs 

Pugazhenthi Chandraboss
par Pugazhenthi Chandraboss , Marketing Manager , Pugazh TV

<HTML>

</HTML>

 

must be include slash tag before save the page like </html>

More Questions Like This