-
Notifications
You must be signed in to change notification settings - Fork 57
Elements Nodes
A Node is an interface from which a number of DOM types inherit, and allows these various types to be treated (or tested) similarly. Ref: https://developer.mozilla.org/en-US/docs/Web/API/Node
The Element interface represents an object of a Document. This interface describes methods and properties common to all kinds of elements. Specific behaviors are described in interfaces which inherit from Element but add additional functionality. For example, the HTMLElement interface is the base interface for HTML elements, while the SVGElement interface is the basis for all SVG elements. Ref: https://developer.mozilla.org/en-US/docs/Web/API/Element
An object may represent anything. Objects have properties, which describe them, and methods which are actions that can be performed on them.
Putting it together:
You can create a DOM Node in a web page like so:
var node = document.createTextNode('A Node');
Then you can create a paragraph element:
var p = document.createElement('p');
Attach the node to the paragraph:
p.appendChild(node);
You may also reference the node and element as objects:
p.className = 'description'; // set the class property of the paragraph to 'description';
p.setAttribute('data-item', '8'); // add an attribute named data-item with a value of 8
This function will simply return true
or false
if the object that you gave it is a Node element
$.select()
/ $.s()
function to select something. Use instead the $.single()
function or native JavaScript functions.
This function will simply return true
or false
if the object that you gave it is an element
$.isNode()
function, do not use the $.select()
/ $.s()
function to select something. Use instead the $.single()
function or native JavaScript functions.
This function will take as argument a single element ($.single()
), and will convert it to a NodeList with this element
Don't hesitate to ask your questions
- 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()