javascript - Input isn't autofocusing when triggered -


codepen

basically want input field contained within div autofocus when opens. @ moment, auto-focus, when div closing.

the div input contained trigger 2.

<ul>     <li>          <span class="trigger" data-target-id="target-1">trigger 1</span>          <div id="target-1" class="target">target reveal when press trigger 1</div>     </li>     <li>          <span class="trigger" data-target-id="target-2" id="search-trigger">trigger 2</span>          <div id="target-2" class="target">target reveal when press trigger 2           <input id="boom" type="text">           </div>     </li>     <li>          <span class="trigger" data-target-id="target-3">trigger 3</span>     </li> </ul>  <div id="target-3" class="target">this recipient intentionally outside ul containing triggers</div>  

and jquery:

// code input focus  $("#search-trigger").click(function(){   $("#boom").focus(); }); 


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -