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

RadDropDownList Blur

2 Answers 93 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Tim asked on 08 Oct 2020, 01:37 AM

After the user selects an option from a RadDropDownList, I would like the control to lose focus. I've tried various things like calling blur and trying to set focus to another element in both the OnClientItemSelected and OnClientDropDownClosed events but nothing seems to work. Is there a way to do this in JavaScript code?

Thanks

2 Answers, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 13 Oct 2020, 11:22 AM

Hi Tim,

The OnClientItemSelected seems to be suitable for the purpose. Please try to trigger the blur event in a setTimeout function:

function onClientItemSelected(sender, args) {
    setTimeout(function () {
        var $ddl = $(sender.get_element());
        $ddl.trigger("blur");
        $ddl.children('.rddlInner').removeClass('rddlFocused');
    });
}

Here are some resources related to the suggested sample above:

I hope this will help.

Kind regards,
Doncho
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Tim
Top achievements
Rank 3
Iron
Iron
Iron
answered on 14 Oct 2020, 04:26 PM

That works great. Thanks for your help!

Tags
DropDownList
Asked by
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Doncho
Telerik team
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or