Focus on the Divi Password Box module on load

Written by Dan Mossop

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.

Secure Your Content with Style!

Upgrade your password-protected pages with Divi Password Box! This module allows you to customize and enhance the password entry experience, ensuring your protected content looks fantastic and remains secure.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

2 Comments

  1. Merci c'est que je recherchais !

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

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

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

We may earn a commission when you visit links on our website.