Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Lucile's button page</title>
- </head>
- <body>
- <button id="click-me-button">click me!</button>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
- <script>
- var wordList = [
- 'baguette',
- 'vin',
- 'lucile',
- 'vive la france',
- 'mischa',
- 'croissant'
- ];
- $('#click-me-button').click(function() {
- var buttonLength = wordList.length;
- var randomNumber = Math.floor((Math.random() * buttonLength));
- alert('le word of choice is: '+wordList[randomNumber]);
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement