Set focus to the ColorPicker control manually using the jquery function

2 posts, 1 answers
  1. Smit
    Smit avatar
    6 posts
    Member since:
    Apr 2018

    Posted 18 Jun 2018 Link to this post

    I need to set the focus to the Color Picker control from the user-defined jquery function.

    Kindly Help, Thankx in Advance.
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    5614 posts

    Posted 18 Jun 2018 Link to this post

    Hello,

    I just answered your support ticket with this question and I am pasting the answer here as well for anyone else having the same query.

    Here is an example that shows how you can use jQuery to traverse the DOM in order to get the element that you want to focus:

    <ol>
        <li>click the button</li>
        <li>press enter to expand the color picker</li>
    </ol>
     <asp:Button Text="focus color picker" ID="testBtn" OnClientClick="focusColorPicker(); return false;" runat="server" />
    <telerik:RadColorPicker runat="server" ID="rcp1" RenderMode="Lightweight" ShowIcon="true"></telerik:RadColorPicker>
     
    <script>
        function focusColorPicker() {
            //see more on referencing controls on the client here https://docs.telerik.com/devtools/aspnet-ajax/general-information/get-client-side-reference
            $telerik.$("[id^='rcp1']").find(".rcpIcon a").first().focus();
        }
    </script>


    Regards,
    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top