Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created January 3, 2016 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/4669108a34447e02877b to your computer and use it in GitHub Desktop.
Save chuck0523/4669108a34447e02877b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React風のjQuery</title>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body>
<span id="colored-counter">0</span>
<input id="color"></input>
<button id="inc"></button>
<script>
$('#color').on('keyup', function () {
$('#colored-counter').css('color', this.value);
})
$('#inc').on('click', function () {
var oldValue = $('#colored-counter').html();
var newValue = 1 + Number(oldValue);
$('#colored-counter').html(newValue);
})
</script>
</body>
</html>
<!-- code is cited from http://postd.cc/boiling-react-down-to-a-few-lines-in-jquery/ -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment