1
<th class="dropdown" id="header">
  <span>Label</span>
    <span id="filter" class="sort_row glyphicon glyphicon-filter   dropdown-toggle" data-toggle="dropdown" ></span>
  <ul class="dropdown-menu filter-dropdown" role="menu">
     <li >
  <span class="input-group value">
<input type="text"  id="inputField1" name="inputField1"  class="form-  control" ng-model='inputFieldFirst'/>
        </span>
       </li>
      </ul>
   </span>
 </th>

Here I want to focus on the input field when the filter is clicked and the dropdown opens. Is there a way in which I dont have to use the id of the input field and set focus on the input that is present in the dropdown

Hmahwish
  • 2,222
  • 8
  • 26
  • 45

1 Answers1

1

I probably try this.

$( "#filter" ).click(function() {
  $( ".dropdown-menu input:first-child()" ).focus();
});
Kovalcsik
  • 48
  • 6