Skip to content

Instantly share code, notes, and snippets.

@bogoreh
Last active March 12, 2021 06:07
Show Gist options
  • Select an option

  • Save bogoreh/589ee6eb8ec389183bc5044e7c828939 to your computer and use it in GitHub Desktop.

Select an option

Save bogoreh/589ee6eb8ec389183bc5044e7c828939 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Spin-off of "Challenge: Mad Libs"</title>
</head>
<body>
<h1>Mad Libs</h1>
<ul>
<li>Noun: <input type="text" id="noun"></li>
<li>Adjective: <input type="text" id="adjective"></li>
<li>Someone's Name: <input type="text" id="person"></li>
</ul>
<button id="lib-button">Lib it!</button>
<p>Generated story:
<span id="story"></span>
</p>
<script>
var libButton = document.getElementById('lib-button');
var libIt = function() {
var storyDiv = document.getElementById("story");
var noun = document.getElementById("noun").value;
var adjective = document.getElementById("adjective").value;
var person = document.getElementById("person").value;
storyDiv.innerHTML = noun+" noun "+adjective+" adjective "+ person;
};
libButton.addEventListener('click', libIt);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment