On jQuery UI's demo web page what is the source code for the "View Source" link? -


Middle Way on the jQuery UI Demo Web Page is the source code of the "View Source" link that opens and closes Is the source code window?

This is just a function in their script which hides and shows the source div:

  if ($ ('# demo-source'). Length == 0) {$ ('& lt; div id = "demo-source"> gt; & lt; a href = "# "Class =" source-off "& gt; view source & lt; / a & gt; & lt; div & gt; & lt; east & gt; & lt; code & gt; & lt; / code & gt; & Lt; / pre & gt; & lt; / div & gt; & lt; / div & gt;) .insertAfter ('# demo note'); $ ('# Demo-source'). ("& Gt; a") (Function () {$ (this) .toggleClass ("source-closed"). ToggleClass ("source-open").); Toggle (); Return false;}) the ending (). Find ("> div"). Hide (); } $ ('# Demo-source code'). Empty (). Text (source);  

, it grabs the code through AJAX (the current page, or when you click on a demo link on the right, it grabs one), it will display it Formats for it, then it sends the function to insert a "visual source" div / link to the right place in the page.


Comments