Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active February 9, 2016 01:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mbostock/1627439 to your computer and use it in GitHub Desktop.
Autofocus
license: gpl-3.0
<!DOCTYPE html>
<input>
<script src="//d3js.org/d3.v3.min.js"></script>
<script>
window.focus();
d3.select(window).on("keydown", function() {
d3.select("input").property("value", d3.event.keyCode);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment