Skip to content

Instantly share code, notes, and snippets.

@iArnaud
Forked from pamelafox/focus.js
Created January 28, 2013 14:05
Show Gist options
  • Select an option

  • Save iArnaud/4655752 to your computer and use it in GitHub Desktop.

Select an option

Save iArnaud/4655752 to your computer and use it in GitHub Desktop.
// 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