Created
September 1, 2012 17:05
-
-
Save pamelafox/3580510 to your computer and use it in GitHub Desktop.
Hack for Android focus() on PhoneGap
This file contains 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
// From Lindsey Simon | |
/** | |
* This is a hack to make text input focus work in Android/PhoneGap | |
* where calling el.focus() doesn't actually have the blinking cursor | |
* effect = scumbag. | |
* @param {Zepto} $el A zepto element. | |
*/ | |
ws.focus = function($el) { | |
var el = $el.get(0); | |
el.focus(); | |
el.setSelectionRange && el.setSelectionRange(0, 0); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment