RadDropDownList Blur

3 posts, 0 answers
  1. Tim
    Tim avatar
    18 posts
    Member since:
    Dec 2013

    Posted 07 Oct 2020 Link to this post

    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. Doncho
    Admin
    Doncho avatar
    114 posts

    Posted 13 Oct 2020 Link to this post

    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).

  3. Tim
    Tim avatar
    18 posts
    Member since:
    Dec 2013

    Posted 14 Oct 2020 in reply to Doncho Link to this post

    That works great. Thanks for your help!

Back to Top