Focus on the Divi Password Box module on load

|

Boost Your Site and Save 20% this Weekend

Join 50,000 users and build a better site with 20% off all Divi Booster plugins.

Discount applied at checkout. Offer ends Monday!

Day(s)

:

Hour(s)

:

Minute(s)

:

Second(s)

Divi Password Box lets you style password protected pages using the Divi Builder. Here's how to ensure that the cursor is focused in the password box module's password field when the page loads.

You should be able to do it by adding the following JavaScript to your site:

<script>
/* Focus on password box module, if present */
if (document.querySelector) {
	var passwordBox = document.querySelector(".et_pb_dbpp_page_password_password");
	if (passwordBox) {
		passwordBox.focus();
	}
}
</script>
You can add it in the "Divi > Theme Options > Integration > Add code to the < body >" box.

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin

2 Comments

  1. Merci c'est que je recherchais !

    Reply
    • You're very welcome, Exocet-Web!

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *