zjrJS Javascript Library

zjrJS.Doc.dCl() - zjrJS Javascript Library

This information lives on a webpage hosted at the following web address: 'https://omegajunior.globat.com/code/zjrjs/'.

How to use zjrJS.Doc.dCl() ("delete class")

Declaration
zjrJS.Doc.dCl(String className, HtmlElement Target)

Goal
A cross-browser method to delete CSS classes from elements. dCl() ensures to remove any doubles.

Typical usage
Wherever CSS classes need to be removed from elements.

Member Type
Function.

Value Type
Before Nov. 27, 2011: Object (the Target HtmlElement), when both className and Target were supplied, otherwise null.
After Nov. 27, 2011: Object (the Target HtmlElement), allowing for continuation.

Parameters
String className: any valid CSS class name to remove. Mind you that you are responsible for choosing names that work.
HtmlElement Target: the element (either generated (Doc.cE() or document.createElement()) or retrieved (Doc.eid() or document.getElementByID() etc.)) which should be freed of the className.

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(){
var D=zjrJS.Doc;
var P=D.eid("chooseMe");
if(P){
D.dCl("bigFont",P);
}
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 id="chooseMe" class="smallFont">The text size of this paragraph should look smaller, unless javascript is enabled: then it should look medium as well.</p>
<p class="bigFont">The text size of this paragraph should look bigger.</p>
</body>
</html>

Download:

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

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

Clicky Analytics