This is a migrated thread and some comments may be shown as answers.

Detection if RadTextBox has focus through jQuery

1 Answer 91 Views
Input
This is a migrated thread and some comments may be shown as answers.
Vasssek
Top achievements
Rank 1
Vasssek asked on 19 Feb 2019, 11:51 AM

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

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 22 Feb 2019, 12:38 PM
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.
Tags
Input
Asked by
Vasssek
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or