Skip to content

Instantly share code, notes, and snippets.

@baconator
Created February 1, 2015 00:47
Show Gist options
  • Select an option

  • Save baconator/36d0f839a95aa43e2ad9 to your computer and use it in GitHub Desktop.

Select an option

Save baconator/36d0f839a95aa43e2ad9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<label for="wordInput"><span>Input String</span></label>
<input type="text" name="wordInput"/>
<script id="jsbin-javascript">
$(document).ready(function(){
console.log("Started!");
$("*[name='wordInput']").on("keydown", function(event){
console.log(event.which.toString() + " " + this.selectionStart.toString());
});
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script>
<script src="http://d3js.org/d3.v3.min.js"><\/script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<label for="wordInput"><span>Input String</span></label>
<input type="text" name="wordInput"/>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">$(document).ready(function(){
console.log("Started!");
$("*[name='wordInput']").on("keydown", function(event){
console.log(event.which.toString() + " " + this.selectionStart.toString());
});
});</script></body>
</html>
$(document).ready(function(){
console.log("Started!");
$("*[name='wordInput']").on("keydown", function(event){
console.log(event.which.toString() + " " + this.selectionStart.toString());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment