You can do this by adding this bit of jQuery code, for example at your footer.php
, right before the </body>
tag closure:
<script>
$('input.field').attr('autocomplete', 'off');
</script>
Or the same thing but with pure JavaScript:
<script>
var x = document.querySelectorAll("input.search-field");
for (i = 0; i < x.length; i++) {
x[i].autocomplete="off"
}
</script>
This will add autocomplete="off"
for all the search-boxes with the class .search-field
on your document, which I think all of them have. Here’s an example.
You could implement it directly where the search-box is situated (header.php
), but you would need to recreate the search-box, because it’s implemented dynamically like this – <?php get_search_form(); ?>
inside the file header.php
. So you would need to replace that code, with something like this:
<form role="search" method="get" class="search-form" action="http://detergentingredients.com/">
<label>
<span class="screen-reader-text">Search for:</span>
<input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" autocomplete="off"/>
</label>
<input type="submit" class="search-submit" value="Search"/>
</form>