zjrJS.Doc.eid() - 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'.

How to use zjrJS.Doc.eid() ("element by id")

Used zjrJS Version:

Stable Minified version 20141202t2322 of zjrJS.

There is no newer Beta version available.


 

Declaration
zjrJS.Doc.eid(String identification)

Goal
A short-cut for getElementById(), eid() ensures all needed objects and functions do exist.

Typical usage
Wherever you wish to retrieve a handle to an element based on thecontents of its id attribute.

Member Type
Function.

Value Type
Object (the found HtmlElement), if any element in the current web page bears the provided id, otherwise null.

Parameters
String identification: any valid HTML id attribue verb. Mind you that you are responsible for choosing ids that work.

Dependencies
None.

Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="zjrJS.version.js" id="zjrJS"></script>
<script type="text/javascript">/* <![CDATA[ */
zjrJS.Doc.aE(window,"load",function(){
//reference the Doc object
var D=zjrJS.Doc;
//retrieve an HtmlParagraphElement
var P=D.eid("chooseMe");
if(P){
//add a CSS class
D.aCl("bigFont",P);
}
//clean up memory
D=P=null;
});
/* ]]> */</script>
<style type="text/css">/* <![CDATA[ */
body{font-size:medium}
.smallFont{font-size:smaller}
.bigFont{font-size:larger}
/* ]]> */</style>
</head>
<body>
<p>The text size of this paragraph is medium.</p>
<p class="smallFont">The text size of this paragraph should look smaller.</p>
<p id="chooseMe">The text size of this paragraph should look bigger, but only if javascript is enabled.</p>
</body>
</html>

Download:

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

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