Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
How can I point a label to a webdropdown control? I can't seem to get the ID
posted

Hi,

I'm working with bootstrap and I'm adding in accessibility to my site. 
It looks like <label for= can only point to an input. The clientID currently points to the table that the webdropdown is built in.
How would I correctly point the for= at the drop down input.

Thanks

  • 60
    Offline posted

    Dear Matthew Beste,

    Thank you for posting in our forum.

     

    Please be advised that the way to access the dropdown’s input and for instance set focus to it, when the label attached to the dropdown is clicked, is to do something along the lines of:

    <head runat="server">
        <script type="text/javascript">
            function onLabelClick() {
           	    $find("MyDropDown")._elements.Input.focus();
            }     
        </script>
    </head>
    
    <body>
        <label onclick="onLabelClick()" for="MyDropDown">SOME LABEL</label>
        <ig:WebDropDown ID="MyDropDown" runat="server">
        </ig:WebDropDown>
    </body>
    

    If you look at the "$find("MyDropDown")._elements.Input.focus();" line, you would notice that we directly access the Input element of the dropdown, we can manipulate it as any HTML element.

    Please be sure to reach out to us again if you need additional assistance.