jquery how to set input focus on control

Posted by user516883 on Stack Overflow See other posts from Stack Overflow or by user516883
Published on 2011-01-10T22:30:00Z Indexed on 2011/01/10 22:53 UTC
Read the original article Hit count: 139

Filed under:
|

Hey I am very new to jquery using asp.net, and I was wondering how to set focus on a textbox using jquery.

I have my script in my HeaderContent but it is not working, no focus on load. And yes I know this can be done on the server side as well, but I am just trying to get better and more familiar with jquery. Thanks.

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

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about input