Back to all Elements

Scroll & Focus

Scroll down and focus on an input field when a button is clicked

* This method also opens the keyboard when user is on mobile.

So, this one is easy peasy ;)

Add this code to your page before </body> tag

<script>

$('.btn').click(function () {

   $('html').animate({scrollTop: $('#email').offset().top - 200}, 1000);

   $('#email').focus();

});

</script>

Copy

Then give your button a 'btn' ID, and to the input field 'email' ID.

THAT's IT !

really!

Preview:

#StayTheFuckHome. Wash Hands. Wear gloves & mask if you have to leave home.

Might also interest you:

Hover to reveal Mask

Cloneable
Code
Design

A fixed background image that is revealed by mouse hover all over the section

Read more

Auto Change Tabs 2.0

Cloneable
Code
Interactions

A new and improved version for a Tabs element that automatically change tabs

Read more

Changing Text

Interactions
Cloneable
Tricks

Change text in a sentence/headline with Webflow's interactions

Read more