Object: hsVariables
Functions
EventsObject: hs.ExpanderVariablesFunctionsEvents
|
hs.Expander.prototype.onAfterGetContentFires after the HTML content is grabbed.
void hs.Expander.prototype.onAfterGetContent ( hs.Expander sender )
At this time, Ajax loaded content and iframes are injected into the DOM, and edits and replacements to the content can be done before it is displayed. The content div can be accessed through
sender.content .Details
Parameters
ExampleReplacing text in the contentThis example shows how to edit the self-rendered content wrapper. We will add a custom button at the end of the controlbar unordered list. Put this in the head section of your page: <script type="text/javascript"> hs.Expander.prototype.onAfterGetContent = function (sender) { // get the controlbar var ul = sender.content.getElementsByTagName("ul")[0]; // create a list item var li = document.createElement("li"); ul.appendChild(li); // create an anchor var a = document.createElement("a"); a.href = "javascript:alert('I am a custom button')"; // create a text node var text = document.createTextNode("Custom"); a.appendChild(text); li.appendChild(a); } </script> The markup for the opening anchor: <a class="textbutton" href="/include-short.htm" onclick="return hs.htmlExpand(this, { objectType: 'ajax' })"> Click to open </a> See the effect: Click to openSee also |