Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$('input, select').focus_select() will focus the <select> and select the <input>. select does not work on <select>s
jQuery.fn.focus_select = function() {
return this.each(function(){
var $this = jQuery(this);
if ( $this.is('select') ) {
$this.focus()
} else {
$this.select()
}
})
}
@tordans

This comment has been minimized.

Copy link

@tordans tordans commented Jun 3, 2011

Thanks, I have been writing about this to make more ux-designer aware of this possiblity http://uxzentrisch.de/fokus-cursor-input/ (in german).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment