I'm currently working on a site with a contact tab on the top of the site, and am trying to create text to expand/collapse above the tab. The js code I am trying to use is from web standards and near the bottom of that link. I have added all the required ID's and CSS as stated in the comments. The JS code however is returning an error "NOT_FOUND_ERR: DOM Exception 8" at the line of remove child in this part of the codeHow can I fix this error and get the code working properly?Code:stmjr_collapse.prototype.swapAnchorText = function(newText) { // Swap out title text on the anchor this.anchor.title = newText; // Clear out all children of the anchor var len = this.anchor.childNodes.length; for (i = 0; i < len; i++) { this.anchor.removeChild(this.anchor.childNodes[i]) } // Add the new link text to the anchor this.anchor.appendChild(document.createTextNode(newText)); }
Thank you in advance!


Reply With Quote

Bookmarks