Last active
July 7, 2016 18:11
-
-
Save Echostream/fe560aa30271172398cf432b7b281fd5 to your computer and use it in GitHub Desktop.
Enable gi to focus the first text box on the whole web page by SurfingKeys
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
mapkey('gi', 'test', function() { | |
var inputs = document.getElementsByTagName('input'); | |
var input = null; | |
for(var i=0; i<inputs.length; i++) { | |
if(inputs[i].type=='text') { | |
input = inputs[i]; | |
break; | |
} | |
} | |
if(input) { | |
input.click(); | |
input.focus(); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment