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

Set focus to the ColorPicker control manually using the jquery function

1 Answer 59 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Smit
Top achievements
Rank 1
Smit asked on 18 Jun 2018, 10:48 AM
I need to set the focus to the Color Picker control from the user-defined jquery function.

Kindly Help, Thankx in Advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 18 Jun 2018, 04:01 PM
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.
Tags
ColorPicker
Asked by
Smit
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or