Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Created January 2, 2015 10:12
Show Gist options
  • Save barneycarroll/4dbafe9809448cb44e6d to your computer and use it in GitHub Desktop.
Save barneycarroll/4dbafe9809448cb44e6d to your computer and use it in GitHub Desktop.
Autofocus for Mithril
function autofocus( el, init ){
if( !init ) el.focus();
}
@barneycarroll
Copy link
Author

Intended usage:

m( 'input', {
  config : autofocus
} );

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