[英]JQuery focus on first textbox in aspxdockpanel
having problems if i wish to set focus the textbox inside the aspxdockpanel, while im testing with not using aspxdockpanel then i can be focus on the textbox, after i use aspxdockpanel then face the problem with jquery focus on the first textbox 如果我想将焦点放在aspxdockpanel内时遇到问题,而即时通讯测试中不使用aspxdockpanel,那么我可以专注于文本框,在我使用aspxdockpanel之后,jquery将注意力集中在第一个文本框上
$(document).ready(function () {
$(function () {
$('input[type!=hidden],input[type="text"], not input[type="button"]:last').first().focus();
});
});
<dx:ASPxDockPanel ID="ASPxDockPanel1" runat="server" ShowHeader="true" ClientInstanceName="ASPxDockPanel1" Border-BorderColor="Red" >
<ContentCollection>
<dx:PopupControlContentControl>
<table>
<tr>
<td>
<dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="ASPxLabel">
</dx:ASPxLabel>
</td>
<td>
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px" ClientInstanceName="ASPxTextBox1">
</dx:ASPxTextBox>
</td>
</tr>
</table>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxDockPanel>
As the textbox has an ID you can use it 由于文本框具有ID,因此您可以使用它
$(document).ready(function () {
$("#ASPxTextBox1").focus ();
});
No need for function()
不需要function()
Try 尝试
$(document).ready(function () {
$('#ASPxDockPanel1').find('input[type="text"]:first').focus();
});
or Use ClientID
或使用ClientID
$('#<%= ASPxTextBox1.ClientID %>').focus();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.