javascript - Input isn't autofocusing when triggered -
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
Post a Comment