Skip to content

Instantly share code, notes, and snippets.

@mjchamplin
Created December 9, 2014 00:12
Show Gist options
  • Save mjchamplin/47d2d87149bac45c993b to your computer and use it in GitHub Desktop.
Save mjchamplin/47d2d87149bac45c993b to your computer and use it in GitHub Desktop.
Five Minute Text Randomizer
<html>
<head>
<title>testing</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
// This script randomly populates an item (.quote) with a string from the array "quotes". ie random quote display, etc.
$(document).ready(function() {
var quotes = new Array("pie", "cookies", "coffee", "Kaytee"),
randno = quotes[Math.floor( Math.random() * quotes.length )];
$('.quote').text( randno );
});
</script>
<style>
.quote { color: red; }
</style>
</head>
<body>
<h1>Michael likes <span class="quote"></span></h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment