This repository was archived by the owner on Jun 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
$.component()
Arthur Guiot edited this page Oct 13, 2017
·
2 revisions
Custom Elements is a capability for creating your own custom HTML elements. They can have their own scripted behavior and CSS styling. They are a part of web components, but can also be used by themselves.
As you'll understand, using the $.component() function, we'll be able to have elements like that in our DOM:
<hello-element name="Jane"></hello-element><br>
<hello-element name="Arthur"></hello-element><br>
<hello-element name="World 🌎"></hello-element>This function will only take 2 arguments:
-
name- the name of your custom HTML element.⚠️ Custom elements needs a-in their name. -
callback- The operation you'll apply to each element.
HTML:
<hello-element name="Jane"></hello-element><br>
<hello-element name="Arthur"></hello-element><br>
<hello-element name="World 🌎"></hello-element>JS:
$.component("hello-element", function(el) {
$.html($.s(el), `Hello ${el.getAttribute("name")}`)
})- Home
- The Core Languages
- Getting Started: Installation
- The Basics (
$.var()+$.target()) - Developing for DisplayJS
-
$.select()- Text related
- If...else
$.xss()$.repeat()$.custom()$.live()$.load()$.on()$.onEvent()$.ready()- Scroll API
$.all()$.clone()$.is()$.valEmpty()$.remove()$.show()&$.hide()$.ajax()- Class Related
$.css()$.getStyle()- Fade effects
$.extend()$.dynamic()$.parent()- Elements-Nodes
$.component()$.time_ago()$.copy()$.then()$.sleep()$.getProp()