javascriptformstext-cursor

set cursor in login form field on page load


I'm trying to get my cursor to load in my login form field on page load. So i'm using this code that supposedly works in every browser but i can't get it to work in any browser lol.

<script type="text/javascript">
$(document).ready(function(){
document.login.input.focus();
});
</script>

Here's the page I'm trying to add it to: http://test.clickacart.com

This should load the cursor in the first username/email field on page load so user doesn't have to click inside to fill it out.


Solution

  • $(function() { $('[name="email_address"]').focus(); });