Created
December 10, 2013 01:41
-
-
Save zerobase/7884477 to your computer and use it in GitHub Desktop.
"compositionstart" and "compositionend" events, and Japanese Input Method
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> | |
<title>"compositionstart" and "compositionend" events, and Japanese Input Method</title> | |
</head> | |
<body> | |
<textarea name="textarea" id="textarea" cols="30" rows="3"></textarea> | |
<h2>onkeydown</h2> | |
<p>nowCompositioning: <span id="nowCompositioning"></span></p> | |
<p>keyCode: <span id="keyCode"></span></p> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var nowCompositioning = false; | |
$('#textarea').on('compositionstart', function (ev) { | |
nowCompositioning = true; | |
}); | |
$('#textarea').on('compositionend', function (ev) { | |
nowCompositioning = false; | |
}); | |
$('#textarea').on('keydown', function (ev) { | |
$('#nowCompositioning').text(nowCompositioning); | |
$('#keyCode').text(ev.keyCode); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment