Last active
August 29, 2015 14:17
-
-
Save fatorx/2d1c53b5eec5175214a7 to your computer and use it in GitHub Desktop.
Focus in canvas element (HTML5)
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
// With Jquery | |
$(function() { | |
$("#canvas").click(); // simulate click in canvas element | |
}); | |
// Or pure javascript | |
window.onload = function() { | |
var canvasElm = document.getElementById('canvas'); | |
canvasElm.setAttribute('tabindex','0'); | |
canvasElm.focus(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment