Skip to content
A nicer way of asking for focus on a form element
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Polite Focus

Don't be rude to your users. Let them decide what to focus on.

This is a nice way of asking the browser to give you focus of a form field. Better yet, it's simple. If no other field has focus, you can have it. If some other field has focus, leave it there.


<form action="" method="post">
    <fieldset id="your_login_form" class="">
        <legend>Your login form</legend>
        <label for="username">Username</label><input type="text" name="username" value="" id="username">
        <label for="password">Password</label><input type="password" name="password" value="" id="password">
        <button type="submit">Login</button>

/* <![CDATA[ */
/* ]]> */
You can’t perform that action at this time.