Streaming live at 10am (PST)

Auto Focus Search on click

Im having a hard time getting autofocus to work

Classname for Toggle is nav-link-search

Here is version 1

Here is version 2

<!-- Start Search Auto Focus V2 -->
$('.nav-link-search').click(function () {
<!-- End Search Auto Focus -->

Preview io link

Project Share Link:

Code that depends on jQuery needs to be loaded in the before body close area. Won’t work in an embed. A quick check of the console shows the issue.

Thanks @webdev

That appears to do the trick!


I have an unusual case of Focus on second click. I tested various combinations of .class and #div-id matches on both paarent search div and search asset, with the same result. It only aito focus onsecond click. I’m lost as how how to resolve this.

Preview Link:

Share Link: