Add 'autofocus' attribute to search inline

Hello,

How can I add the ‘autofocus’ attribute to the X theme search inline element?

Regards,

Alex

Hi Alex,

Thanks for writing around! You can do it with custom jQuery script, add the following code in your Customizer via Appearance > Customize > Custom > Edit Global Javascript

jQuery(document).ready(function($){
	$('.x-search-input').prop('autofocus', true);
	$('.x-search-input').focus();
});

Don’t forget to clear your browser’s cache after adding the code. Let us know how this goes!

1 Like

Awesome - thanks!

1 Like

You’re welcome.

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