I am using the following code to create a (nodelist? [of children]) of "genText"-class divs that are appended to a (parent?) "classContainer" div:
- $(".classContainer")
- .append($("<div class=genText " +
- "firstWord=" + firstWord + " " +
- "taxYear =" + taxYear + " " + ">" + currentLine + " | " + lColor + "</div>")
- .css({ color: lColor }));
After I have my wrapped set of [something, definitely not Array Elements...jQuery Objects?], then I would like to make changes to some of the individual elements. For that purpose, I have the next bit of code:
- var updatedWrappedSet = $(".classContainer > .genText").each(function() {
- var lineWordArray = this.innerText.reduceWhiteSpace().split(" ");
- var firstWord = lineWordArray[0];
- var secndWord = lineWordArray[1];
- if ( (firstWord == "PHU1") && (secndWord.indexOf("DTE") != -1) ||
- (firstWord.indexOf("+++") != -1) && (secndWord.indexOf("+++") != -1) ||
- (firstWord.indexOf("TRANS") != -1) && (secndWord.indexOf("RPD") != -1) ||
- (firstWord.indexOf("EVNT-") != -1) && (1==1)) {
- if ((firstWord == "PHU1") && (secndWord.indexOf("DTE") != -1)) {
- // top-level node.
- // Great grandparent of the innerMost child (remains a "genText" div sibling)
- } else if ((firstWord.indexOf("+++") != -1) && (secndWord.indexOf("+++") != -1)) {
- // demote this genText div by one level.
- // I would like this to be a grandparent node of the innerMost child
- } else if ((firstWord.indexOf("TRANS") != -1) && (secndWord.indexOf("RPD") != -1)) {
- // demote this genText div by two levels.
- // I would like this to be a parent node of the innerMost child
- } else if ((firstWord.indexOf("EVNT-") != -1) && (1==1))) {
- // demote this genText div node by three levels
- // innerMost child
- }
- } // end if
How do I create an updatedWrappedSet that returns a [restructured] div like the one above?
Thanks