Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello sir,
i want to use focus on ('itemcode') on page load
and as we normaly use i used script as
............
$("itemcode").focus();
or
settimeout(function(){
      $("itemcode").focus();
});

$("itemcode").focus();
or
settimeout(function(){
      $("itemcode").focus();
});

problem =
focus completely worked in firefox
but its not worked in chrome
in chrome on page loading i can see curser in textbox for a second and immediately focus will be removed...
please give me a solution which support in all browsers
thank you in advance..
Posted

1 solution

Try this-
JavaScript
setTimeout(function(){
   $("#itemcode").focus();
        }, 1);

Hope, it helps :)
 
Share this answer
 
Comments
Manish Dalwadi 11-Jan-15 10:21am    
dr, i alrdy gien time but not worked..
and i just show you that what i done for focus

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