简体   繁体   中英

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

  $(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

$(document).ready(function () {
      $("#ASPxTextBox1").focus ();
});

No need for function()

Try

$(document).ready(function () {
    $('#ASPxDockPanel1').find('input[type="text"]:first').focus();
});

or Use ClientID

$('#<%= ASPxTextBox1.ClientID %>').focus();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM