Focus on the Divi Password Box module on load

|

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.

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.