Nov 10, 2019
White Arrow icon
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:

Share:

When your bath soap bar gets too small to use, don't throw it away! open the next bar, and when you finish showering, stick the small old bar to the back of the new bar. Onces they both dry, they will become one.

Might also interest you:

3d Video Slider (swiper.js)

Cloneable
CMS
JavaScript

A 3d slider with video items, plays and pauses on click & slide change.

Read more
White Arrow icon

Webflow Dashboard Workspaces Hack

Webflow UI Hack
Code
CSS

Convert the Workspaces dropdown to an open sidebar with custom order.

Read more
White Arrow icon

Glossary

Cloneable
JavaScript
CMS

A clonable for creating an Alphabetical glossary

Read more
White Arrow icon