C’mon… make it easy on yourself. Especially if you’re using MetaBox.io ❤️
What it does…
Forces a select2 input field to autofocus when clicked.
Why it does it…
On some sites I use a lot of select2 autocomplete dropdown lists (especially if I’m using MetaBox.io ❤️). But sometimes you click on or tab to those little buggers and the text input doesn’t focus. This tries to fix that.
How it does it…
This JS finds the select2 input and listens for clicks. When the dropdown opens, it triggers the input to focus.
Use the JSON file for easily importing into your CodeSnippetsPro plugin.
Use the PHP file or just copy/paste the code sample into your functions.php if you’re not using CodeSnippetsPro.
Leave a Reply