Search Inline - Turn autocomplete off

Hi, How do I turn autocomplete off in the search inline element?

I am using x theme pro

Hello There,

Thanks for writing in!

Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

After the child theme is set up, please add the following code in your child theme’s functions.php file

// Navbar Searchform Popup
// =============================================================================

if ( ! function_exists( 'x_navbar_searchform_overlay' ) ) :
  function x_navbar_searchform_overlay() {

    if ( x_get_option( 'x_header_search_enable' ) == '1' ) :

      ?>

      <div class="x-searchform-overlay">
        <div class="x-searchform-overlay-inner">
          <div class="x-container max width">
            <form method="get" id="searchform" class="form-search center-text" action="<?php echo esc_url( home_url( '/' ) ); ?>">
              <label for="s" class="cfc-h-tx tt-upper"><?php _e( 'Type and Press &ldquo;enter&rdquo; to Search', '__x__' ); ?></label>
              <input type="text" id="s" class="search-query cfc-h-tx center-text tt-upper" name="s" autocomplete="off">
            </form>
          </div>
        </div>
      </div>

      <?php

    endif;

  }
  add_action( 'x_before_site_end', 'x_navbar_searchform_overlay' );
endif;

Hope this helps. Please let us know how it goes.

Hi, thanks for replying -

I am still having the same issue. Double clicking the search element brings this drop down. When I inspect element and add autocomplete=“off” attribute to the form tag, it goes away.

Where is the html for the search inline element?

Hello There,

The search inline is part of the search element in the editor. To turn off the auto complete, please add this JS code in the X > Theme Options > Global JS (http://prntscr.com/evswzb)

(function($){
	$('.x-search-input').attr("autocomplete", "off");
})(jQuery);

Hope this helps.

THANK YOU!!! It works now!

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.