Skip to content

Instantly share code, notes, and snippets.

@Auraelius
Created May 7, 2015 02:29
Show Gist options
  • Save Auraelius/56ca0a21b2c8b523d33d to your computer and use it in GitHub Desktop.
Save Auraelius/56ca0a21b2c8b523d33d to your computer and use it in GitHub Desktop.
glossary, v1
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<style>
body {
font-family: "Open Sans", sans-serif;
}
</style>
</head>
<body>
<h1>Glossary</h1>
<h2>Word List</h2>
<dl id="wordList"></dl>
<script>
$(document).ready( function(){
displayDictionary();
});
function displayDictionary(){
var d = initDictionary();
$wordList = $('#wordList');
$wordList.html(" ");
$.each(d, function(index, entry){
$wordList.append("<dt>" + entry.word + "</dt><dd>" + entry.definition + "</dd>");
});
}
function initDictionary(){
var defaultDictionary = [
{word: "foo", definition: "See 'bar'"},
{word: "bar", definition: "See 'foo'"}
];
return(defaultDictionary);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment