Skip to content

Instantly share code, notes, and snippets.

@RakeshChouhan
Created June 17, 2018 15:43
Show Gist options
  • Save RakeshChouhan/c686ab6609379d058de756e17881b1ca to your computer and use it in GitHub Desktop.
Save RakeshChouhan/c686ab6609379d058de756e17881b1ca to your computer and use it in GitHub Desktop.
Web component creation without any framework.
class PopUpInfo extends HTMLElement{
constructor(){
super();
this.attachFunctionality();
}
attachFunctionality(){
var shadow = this.attachShadow({mode:'open'});
var span = document.createElement("span");
span.innerHTML = "Hi Rakesh! your first html Element... Congratulations ...";
shadow.appendChild(span);
}
}
(function(){
alert("hello");
customElements.define("pop-up-info", PopUpInfo);
}())
// In Html add element <pop-up-info></pop-up-info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment