Skip to content

Instantly share code, notes, and snippets.

@alanhay
Created April 15, 2014 10:45
Show Gist options
  • Select an option

  • Save alanhay/10722095 to your computer and use it in GitHub Desktop.

Select an option

Save alanhay/10722095 to your computer and use it in GitHub Desktop.

Revisions

  1. alanhay created this gist Apr 15, 2014.
    15 changes: 15 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <script type="text/javascript">
    $(document).ready(function() {
    // focus on the first visible and enabled input field or textarea
    $(":input:visible:enabled").each(function() {
    if (($(this).attr('type') == 'text') && ($(this).is('input'))){
    $(this).focus();
    return false;
    }
    if ($(this).is('textarea')){
    $(this).focus();
    return false;
    }
    });
    });
    </script>