Created
January 3, 2016 11:09
-
-
Save chuck0523/4669108a34447e02877b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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