Set the input focus to the first input
The first example sets the input focus to the first enabled, visible <input> tag. I have excluded inputs with a class of datePicker, as the JQuery date picker automatically opens when you set the focus to it.
<html> <head> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $("input:visible:enabled:first").not(".datePicker").focus(); }); </script> </body> </html>
The second example sets the input focus to any input field, including <select> and <textarea> tags (there is a leading colon before the word "input").
<html> <head> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $(":input:visible:enabled:first").not(".datePicker").focus(); }); </script> </body> </html>