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.
Most browsers support the autofocus attribute like this...
<input type='...' autofocus />
The other option is to take the jQuery route like this...
$(function () {
$('[autofocus]').focus()
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With