Skip to content

Instantly share code, notes, and snippets.

@robwilkerson
Created December 8, 2011 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robwilkerson/1447086 to your computer and use it in GitHub Desktop.
Save robwilkerson/1447086 to your computer and use it in GitHub Desktop.
jQuery: Workaround for a Webkit bug that prevents input text from being selected on focus.
// The selection is cleared by the mouseup event
// for some stupid reason.
$( '#my-text-field' )
.mouseup( function( e ) {
e.preventDefault();
})
.focus( function( e ) {
$(this).select();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment