GitXplorerGitXplorer
a

Polite-Focus

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
9f3333325f523a9e3302e5892a345241531dfa26

Added readme

aadamyanalunas committed 13 years ago
Unverified
edfa1ce3e52526910a16a95b7e138ff975a308e4

Initial plugin and demo page.

aadamyanalunas committed 13 years ago

README

The README file for this repository.

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.

Example!

<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">
        <br>
        <label for="password">Password</label><input type="password" name="password" value="" id="password">
    </fieldset>
    
    <p>
        <button type="submit">Login</button>
    </p>
</form>

<script>
/* <![CDATA[ */
    $('#username').politeFocus();
/* ]]> */
</script>