Thursday, February 21, 2013

Auto Focus the ASP.NET TextBox using jQuery

.aspx Markup:

<form id="form1" runat="server">
<div class="smallDiv">
<h2>Auto Focus the First TextBox that has Enabled=true</h2>
<asp:TextBox ID="tb1" runat="server" Enabled="false" />
<asp:TextBox ID="tb2" runat="server" Enabled="false" />
<asp:TextBox ID="tb3" runat="server" />
<asp:TextBox ID="tb4" runat="server" Text="Some Text"/>
<br />
Tip: The First two textboxes have been disabled.
You cannot enter text in them.

Jquery Script:
<script src=""></script>
<script type="text/javascript">
$(function() {

Cursor will be focused on the first text box where Enabled=true.

No comments:
Write comments
Recommended Posts × +