Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sumbad/fa6427d7baedc73660198b5f6475405a to your computer and use it in GitHub Desktop.
Save sumbad/fa6427d7baedc73660198b5f6475405a to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Custom Elements</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/document-register-element/1.5.0/document-register-element.js"></script>
<script type="text/javascript">
class HelloInputCustomElement extends HTMLInputElement {
connectedCallback() {
this.setAttribute('value', 'Hello');
}
}
window.customElements.define('helloinput-custom-element', HelloInputCustomElement, {
extends: 'input'
});
</script>
</head>
<body>
<input is="helloinput-custom-element"></input>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment