How to use zjrJS.Doc.rC()
Used zjrJS Version:
Stable Minified version 20141202t2322 of zjrJS.
Declaration
Goal
To remove all child nodes from the given Parent.
Typical usage
Your web page sports an HtmlUnorderedListElement (UL), which should be empty, because you wish to fill it by javascript. Unfortunately, a valid Html document must not contain empty ULs, OLs, or SELECTs, which means you are forced to provide a temporary HtmlListItemElement (LI), or, in the case of a SELECT, an HtmlOptionElement (OPTION). When your javascripted data is received, you need to remove the temporary child before you can add the new data.
Member Type
Function.
Value Type
Object (the same HtmlElement you provided as the Parent argument).
Parameters
HtmlElement Parent: the element (either generated (Doc.cE() or document.createElement()) or retrieved (Doc.eid() or document.getElementByID() etc.)) that serves as the starting point from which to remove child nodes. If Parent is undefined or null, removal will be skipped.
Dependencies
None.
Example
zjrJS.Doc.rC(HtmlElement Parent);
Goal
To remove all child nodes from the given Parent.
Typical usage
Your web page sports an HtmlUnorderedListElement (UL), which should be empty, because you wish to fill it by javascript. Unfortunately, a valid Html document must not contain empty ULs, OLs, or SELECTs, which means you are forced to provide a temporary HtmlListItemElement (LI), or, in the case of a SELECT, an HtmlOptionElement (OPTION). When your javascripted data is received, you need to remove the temporary child before you can add the new data.
Member Type
Function.
Value Type
Object (the same HtmlElement you provided as the Parent argument).
Parameters
HtmlElement Parent: the element (either generated (Doc.cE() or document.createElement()) or retrieved (Doc.eid() or document.getElementByID() etc.)) that serves as the starting point from which to remove child nodes. If Parent is undefined or null, removal will be skipped.
Dependencies
None.
Example
<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, mySelect = D.rC(D.eid("mySelectBox"));
if(mySelect){if(mySelect.options){
mySelect.options.add(new Option("Hello, world!", "helloWorld"));
}}
mySelect=D=null;
});
/* ]]> */</script>