Task Reference: Which method do I need for...? - Beta Test Suite for zjrJS

This information lives on a webpage hosted at the following web address: 'https://www.omegajunior.net/code/zjrjs/beta.php'.

A cheat-sheet reference to zjrJS, based on the task at hand, so you don't have to hunt through the alphabetical listing.

Which zjrJS method do you need for...?

Used zjrJS Version:

Stable Minified version 20141202t2322 of zjrJS.

There is no newer Beta version available.


 

Retrieving an Existing DOM Element
If you know its ID: element = zjrJS.Doc.eid( "uniqueID" )
If you know its Tag: array = zjrJS.Doc.etn( "tagName" )
If you know its Tag and Sort Index: element = zjrJS.Doc.etn( "tagName" )[ index ]

Creating New DOM Elements
Text: text = zjrJS.Doc.cT( "Hello, World!" )
Non-text: element = zjrJS.Doc.cE( "tagName" )

Adding one DOM Element to another
one = zjrJS.Doc.aC( One, Another )
For instance: adding text to a hyperlink, adding that hyperlink to a paragraph, adding that paragraph to a div, and adding that div to the body.

Removing / Deleting all children from a DOM Element
parent = zjrJS.Doc.rC( Parent )


Adding a CSS class name to a DOM Element
element = zjrJS.Doc.aCl( "className", Element )

Removing / Deleting a CSS class name from a DOM Element
element = zjrJS.Doc.dCl( "className", Element )

Determining CSS class name presence on a DOM Element
bool = zjrJS.Doc.hC( "className", Element )

Retrieving the Content of a Meta Element
For Named Elements
text = zjrJS.Doc.mbn( "name" )
Returns a comma-separated list for all meta elements with the same name.
For Http-Equiv Elements
text = zjrJS.Doc.mbh( "equivalent" )
Returns a comma-separated list for all meta elements with the same http equivalent.

Adding an Event Handler to a DOM Element
element = zjrJS.Doc.aE( Element, "eventType", functionReference )
Also see our Best Practice for Event Registration.

Removing / Deleting an Event Handler from a DOM Element
element = zjrJS.Doc.dE( Element, "eventType", functionReference )

Determining the Source of a Propagated Event
element = zjrJS.Doc.eS( Event )

Preventing Propagation of the Event
false = zjrJS.Doc.eP( Event )
Also prevents default actions and cancels bubbling.

Loading Additional Scripts / Retrieving Data
zjrJS.Doc.lS( "url", "newID", "mediaType", cacheInterval )
Also see our Best Practice for Loading Data.

Storing Data in the Browser
zjrJS.Doc.Store.set( "keyName", "text" )
Uses HTML5 localStorage if available. Falls back to cookies.

Retrieving Data previously stored in the Browser
text = zjrJS.Doc.Store.get( "keyName" )

Making older Internet Explorers recognise HTML5 Elements
zjrJS.MSIE.h5A()
This needs to get executed before reading CSS that should apply to HTML5 elements.

Download:

Download zjrJS’ latest stable build (20141202t2322) minified (7.1KB).

Download zjrJS’ latest stable build (20141202t2322) (11.9KB).