Skip to content

Instantly share code, notes, and snippets.

@bokuo-okubo
Created August 14, 2018 15:56
Show Gist options
  • Save bokuo-okubo/8fbf9843a53bf886357134164f2177af to your computer and use it in GitHub Desktop.
Save bokuo-okubo/8fbf9843a53bf886357134164f2177af to your computer and use it in GitHub Desktop.
GBLwMa
<button id="trigger-button">toggle!</button>
<div id="viewer">
<div id="value-field"></div>
</div>
(function() {
var displayArray = ['😆', '🤔', '😭'];
var display = displayArray[0];
var counter = 0;
$('#value-field').text(display);
$('#trigger-button').click(function() {
counter += 1;
display = displayArray[counter % displayArray.length];
$('#value-field').text(display);
});
})();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
#viewer {
width: 200px;
height: 200px;
border-style: solid;
border-width: 1px;
text-align: center;
}
#value-field {
padding: 10px 10px;
font-size: 180px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment