Set focus after click event

2 posts, 0 answers
  1. Scott
    Scott avatar
    5 posts
    Member since:
    Jan 2013

    Posted 25 Mar 2014 Link to this post

    I have a Kendo button with the click event defined as:

    @(Html.Kendo().Button()
                        .Name("btnAddNewLineItem")
                        .Tag("span")
                        .Icon("plus")
                        .Content(@InvSubModule.Infrastructure.Localization.ResourceManager.GetString("AddNew") +"   " + "<span></span>")
                        .HtmlAttributes( new {type = "button"} )
                        .Events(ev => ev.Click("AddLineItemButtonRequest"))                 
                    )   

    In my JavaScript method: "AddLineItemButtonRequest", the last line sets the focus to another control on the page via jQuery:

    $("#LineItemType").focus();

    However, after this line, the focus is shifted back to the Kendo button above. Is there another way I should be setting the focus?

    Thanks for your time,
    Scott Dulock


  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 26 Mar 2014 Link to this post

    Hello Scott,


    I tried to reproduce the issue on my side, but to no avail. Here is a runnable example, using the web version of the Button widget, which demonstrates a similar scenario - focusing another element in the click event handler.

    Please let me know if I am missing something. If the problem is still persisting, could you send me a runnable example, in which it is reproducing, so I could assist you further?

    Regards,
    Dimiter Madjarov
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top