Created
October 12, 2010 17:31
-
-
Save danott/622573 to your computer and use it in GitHub Desktop.
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
/* While implementing shorturls, I wanted to make the url easily copyable. | |
* To do this, I placed it in a text input field, that was styled like the copy text | |
* of the page. To ease the copying process, I wanted to select the entire contents | |
* of the text on focus. Webkit browser would select on focus, but would then quickly deselect. | |
* This is the workaround I came up with. */ | |
// Meant to select <input type="text" class="short-url" value="http://danott.us/s/123" /> | |
$(".short-url").focus(function(e){ | |
this.select(); | |
}).mouseup(function(e){ | |
e.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment