Skip to content

Instantly share code, notes, and snippets.

@mikebuchanon
Created August 8, 2013 21:55
Show Gist options
  • Save mikebuchanon/6189143 to your computer and use it in GitHub Desktop.
Save mikebuchanon/6189143 to your computer and use it in GitHub Desktop.
Example of how to shove link into Moodle breadcrumbs via HTML/JavaScript...can be used with an 'invisible' HTML block
<script type="text/javascript">// <![CDATA[
var breadcrumb = document.getElementsByClassName('breadcrumb');
var li = document.createElement('li');
var a = document.createElement('a');
var linkText = document.createTextNode("my title text");
var sep = document.createElement('span');
var septext = document.createTextNode("/");
sep.appendChild(septext);
sep.className = "divider";
a.appendChild(linkText);
a.title = "Test Portfolio";
a.href = "http://example.com";
li.appendChild(a);
li.appendChild(sep);
breadcrumb[0].insertBefore(li,breadcrumb[0].childNodes[0]);
// ]]></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment