Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

1.
JavaScript
$(function() {
    $('[autofocus]:visible:not(:focus)').first().focus();
});


2.
JavaScript
$(function() {
    $('[autofocus]:not(:focus)').eq(0).focus();
});

---------------------------------
this is the coding am used for set the focus on the first field.
but focus is not happenning..
Posted
Updated 16-Aug-12 3:07am
v3

1 solution

JavaScript
$(function(){
  $('form').find(':text, textarea').filter(":visible:enabled").first().focus();
})
​
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900