Created
December 8, 2011 14:09
-
-
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.
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
// 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