Skip to content

Instantly share code, notes, and snippets.

@kyleturman
Created March 9, 2017 04:43
Show Gist options
  • Save kyleturman/a395633f0dc2cc90526f084cc6141767 to your computer and use it in GitHub Desktop.
Save kyleturman/a395633f0dc2cc90526f084cc6141767 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=a395633f0dc2cc90526f084cc6141767
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div class="hero">
<h1>Hello again!</h1>
</div>
<p>Welcome to my website! Enter your name below and click the button to say hello. But there's also a bug in the javascript! See if you can find it.</p>
<input id='name' type='input' placeholder="Enter your name" />
<button id='button'>Click to say hello</button>
</body>
</html>
{"enabledLibraries":["jquery"]}
// There's a bug here somewhere, where is it?
function sayHello(name) {
alert("Hello, " + name + "!");
}
$(document).ready(function(){
$('#button').on('click', function(){
var nameValue = $("#name").val();
sayHello();
});
});
body {
text-align: center;
margin: 0;
}
.hero {
background-color: blue;
color: white;
height: 300px;
display: flex;
align-items: center;
justify-content: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment