Author
By Luke Johnson
Date
Oct 10, 2019
Reading Time
2 minute read
Quick Summary ~ A fix for the jump-to-top behaviour when clicking on a Select2 select box.

Select2 is a popular plugin to enhance field

This solution was provided by Andrei Victor.

Include this javascript function in your page directly after the "select2.js" file. Then, set the dropdownPosition option to below wherever you initialize Select2.

And now, with a little CSS and JS, and with no modification to Select2's source code, you will have a Select2 plugin that behaves itself much more predictably.

Web advice in your inbox