Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created September 1, 2012 17:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pamelafox/3580510 to your computer and use it in GitHub Desktop.
Save pamelafox/3580510 to your computer and use it in GitHub Desktop.
Hack for Android focus() on PhoneGap
// 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