• Resolved rafix777

    (@rafix777)


    Hi Damian,

    thanks for great plugin. I want to change it a little. How can I add “autofocus” to input? I have it in menu bar and when you click on an icon, you need one more step and I want to avoid it.

    Thanks a lot for help!
    Rafa?

    PS I saw your answer and solution from the past (10 months ago), but it isn’t worked for me.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Damian Góra

    (@damian-gora)

    Hi,

    This kind of feature is individual and it requires separate code for each case. I prepared the code that will work on your website:

    
    add_action( 'wp_head', function () {
    ?>
    <script>
      (function ($) {
        $(document).on('click', '.header-control .open-search', function ($) {
          var $search = jQuery('.header-control .block-search .dgwt-wcas-search-input');
          if ($search.length > 0) {
            setTimeout(function () {
              $search.focus();
            }, 500);
          }
        });
      })(jQuery);
    </script>
    <?php
    } );
    

    You can add this snippet to your functions.php in the child theme or use the Code Snippets plugin.

    Also, I noticed you have nested <form> in <form> tag. The shortcode you used [wcas-search-form] also has <form> tag. You can’t put this shortcode inside another<form> element.

    Best
    Damian

Viewing 1 replies (of 1 total)
  • The topic ‘Autofocus’ is closed to new replies.