Skip to content

Instantly share code, notes, and snippets.

@cmoscardi
Created February 27, 2017 01:59
Show Gist options
  • Save cmoscardi/1646d4b88434597ee7245187fe776698 to your computer and use it in GitHub Desktop.
Save cmoscardi/1646d4b88434597ee7245187fe776698 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=1646d4b88434597ee7245187fe776698
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div class="part2">
<div class="boxes">
<div class="box" id="box1">1</div>
<div class="box" id="box2">2</div>
</div>
<div class="box-controls">
<input id="box-number" placeholder="enter box #"/>
<button id="hide-button">HIDE</button>
<button id="show-button">SHOW</button>
<button id="add-button">ADD</button>
</div>
</div>
</body>
</html>
{"enabledLibraries":["jquery"]}
$("#hide-button").click(function(){
var number = $("#box-number").val();
$("#box"+number).hide();
});
$("#show-button").click(function(){
var number = $("#box-number").val();
$("#box"+number).show();
});
#full-name {
border: 1px solid black;
height: 30px;
}
.part2 {
margin-top: 50px;
}
.box-controls {
display: flex;
justify-content: center;
}
.boxes {
display: flex;
justify-content: center;
}
.box {
width: 100px;
height: 100px;
margin: 10px;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-size: 40px;
font-family: arial;
background-color: red;
}
#box1 {
background-color: goldenrod;
}
#box2 {
background-color: skyblue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment