Last active
December 25, 2015 03:29
-
-
Save chikoski/6910011 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| .error{ | |
| font-weight: bold; | |
| color: rgb(240, 240, 240); | |
| background-color: rgb(240, 48, 48); | |
| padding: 10px; | |
| } |
This file contains hidden or 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>押すなよ!</title> | |
| </head> | |
| <body> | |
| <form id="input_form"> | |
| <input type="text" id="input" placeholder="テキストを入力してください"> | |
| </form> | |
| <p id="output"> | |
| ここがリアルタイムに更新されます。 | |
| </p> | |
| </body> | |
| </html> |
This file contains hidden or 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
| var inputElm = document.getElementById("input"); | |
| var formElm = document.getElementById("input_form"); | |
| var updateText = function(){ | |
| var outputElm = document.getElementById("output"); | |
| var inputText = inputElm.value; | |
| outputElm.textContent = inputText; | |
| }; | |
| inputElm.onkeyup = updateText; | |
| formElm.onsubmit = function(){ | |
| return false; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment