I am using the following code, which is part of the Bootstrap Framework.
My goal is to focus the input by clicking on <a>name</a> using the Jquery click / focus function. I already know him about the data-toggle="dropdown" attribute in link a so that it doesn't work. I am not very experienced. Hope someone helped me!
<html> <body> <li class="dropdown"> <a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="#"><i class="icon-user"></i> name </a> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> <li> <form ...> <input type="text" id="4711" /> </form> </li> </ul> </li> </body> </html> <script> $('#dLabel').click(function() { $('#4711').focus(); }); </script>
source share