Detection if RadTextBox has focus through jQuery

2 posts, 0 answers
  1. Vasssek
    Vasssek avatar
    186 posts
    Member since:
    Aug 2010

    Posted 19 Feb 2019 Link to this post

    Hi,

    could somebody give me an advice, how to manage if I need to know whether some RadTextbox has focus on not. I know, I can do it through onfocus and onblur client side events, but I want it to achieve through jQuery.

    For now I found this link:

    https://stackoverflow.com/questions/967096/using-jquery-to-test-if-an-input-has-focus

    I tried to to use this $(mytelerikradtextbox).is(":focus") to check whether control has focus, but it still returns false even it has focus. Shouldn't I apply it on input child ?

    Thanks for the right direction :-)

    Vasssek

  2. Vessy
    Admin
    Vessy avatar
    2097 posts

    Posted 22 Feb 2019 Link to this post

    Hi Vasssek,

    You can determine whether a RadTextBox is focused or not from the value of the control's _focus property. For example:
    <telerik:RadTextBox ID="RadTextBox1" runat="server"></telerik:RadTextBox>
     
    <script>
        function pageLoad() {
            setInterval(function () {
                console.log($find("RadTextBox1")._focused);
            }, 500);
        }
    </script>



    Regards,
    Vessy
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top