Title: Automatically submit filters?
Last modified: August 24, 2016

---

# Automatically submit filters?

 *  Resolved [Maveee](https://wordpress.org/support/users/maveee/)
 * (@maveee)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/)
 * First of all: THANK YOU for your great plugin. I love it.
 * What would make it even more awesome is automatically filtering when the user
   clicks an item in the dropdown (I want to get rid of the big green button “APPLY
   FILTER”)
 * How should I approach this?
 * [https://wordpress.org/plugins/beautiful-taxonomy-filters/](https://wordpress.org/plugins/beautiful-taxonomy-filters/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993172)
 * Hi Maveee,
 * The main reason why I’m not doing this is because it works badly with multiple
   filters.. say I want to filter on multiple taxonomies at once, I’ll have to wait
   for each taxonomy-filter to reload the page first.
 * But if you want to do that you could achieve it by looking at the dropdowns .
   change with some custom javascript (jquery) and submit the form.
    Something like
   this might do the trick:
 *     ```
       jQuery('.beautiful-taxonomy-filters-select').change(function(){
       	jQuery('#beautiful-taxonomy-filters-form').submit();
       });
       ```
   
 *  Thread Starter [Maveee](https://wordpress.org/support/users/maveee/)
 * (@maveee)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993192)
 * Thank you for your extended answer!
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993193)
 * No problem, did the code solve it for you?
 * If so I’d like to mark this topic as resolved 🙂
 * Also, if you like the plugin please feel free to leave a review. It helps a lot!
 * Best regards,
    Jonathan
 *  Thread Starter [Maveee](https://wordpress.org/support/users/maveee/)
 * (@maveee)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993195)
 * Marked it as resolved!
    Will do a review too.
 *  [Nils Schönwald](https://wordpress.org/support/users/schoenwaldnils/)
 * (@schoenwaldnils)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993294)
 * Hi,
 * me again ^^
 * this works well if I’m not using select2.
    But when I do, selecting an option,
   doesn’t actually change the ‘selected’ state on the ‘.beautiful-taxonomy-filters-
   select’
 * What about now?
    Preferably select2 should update the ‘selected’ state, doesn’t
   it?
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993295)
 * Hi Nils,
 * Which version of select2 is being loaded if you check the source?
    Select2 should
   respond to the .change event since when changing the select2 dropdown it programmatically
   changes the hidden select-element.
 * You might try changing it to
 *     ```
       jQuery('.beautiful-taxonomy-filters-select').on('change', function(){
       	jQuery('#beautiful-taxonomy-filters-form').submit();
       });
       ```
   
 *  [Nils Schönwald](https://wordpress.org/support/users/schoenwaldnils/)
 * (@schoenwaldnils)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993296)
 * Hi,
 * Select2 4.0.0 is loaded.
 * The hidden select-input doesn’t get updated.
    Thats why your snipped doesn’t 
   work.
 * btw I try to use plain js
 *     ```
       var _ = require('lodash');
   
       _.map(document.getElementsByClassName('beautiful-taxonomy-filters-select'), function(element) {
         element.addEventListener('change', function(){
           document.getElementById('beautiful-taxonomy-filters-form').submit();
         });
       });
       ```
   
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993297)
 * Hi Nils,
    That’s very strange.. in Select2 3.x it works like a charm and in the
   documentation for v4 (albeit a bit lacking) it says it responds the same way 
   to .change events..
 * It’s possible that it’s a bug with the new version.
    Gonna check the github issues
   section to see if it’s been addressed when I find the time (you are welome to
   check too 🙂 ).
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993299)
 * Hi Nils,
 * I’ve tested with 4.0.1 (select2) and it seems to be working. Will soon push out
   a new version 1.2.9 with updated select2.
 *  [karaschenko](https://wordpress.org/support/users/karaschenko/)
 * (@karaschenko)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993300)
 * jquery solution does not work in 1.2.9
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993301)
 * Hi karaschenko,
 * Which version of select2 is being loaded in your site? 1.2.9 should load select2
   4.0.1 and in that version this should be fixed (and works when I’ve tested it).
 * Could you check your source code which version is actually being loaded as it’s
   possible another plugin loads select2 first.
 *  [karaschenko](https://wordpress.org/support/users/karaschenko/)
 * (@karaschenko)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993302)
 * I dont know why, but select2 didnt work width BTF at first, so i desided to install
   select2 manually(4.0.1) and its worked. But then I had to remove the button “
   filter” (project’s design), and found that solution but its not working:( Help
   me plz!
 * Btw, thx for plugin and sry for my english(
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993303)
 * Hi Karaschenko,
 * If it works when you include 4.0.1 in your theme then your problem was probably
   another plugin loading in select2 before BTF. Now your theme get’s priority instead.
 * What have you tried and what is not working?
 *  [karaschenko](https://wordpress.org/support/users/karaschenko/)
 * (@karaschenko)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993304)
 * Jonathan,thx, its work now, but can u help me litle more? I need to change default
   placeholder [http://joxi.ru/Y2LKRoxunbbWPm](http://joxi.ru/Y2LKRoxunbbWPm)
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993305)
 * Good to know.
 * Please post a new topic regarding the placeholders so others can find whatever
   we conclude there as well 🙂

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Automatically submit filters?’ is closed to new replies.

 * ![](https://ps.w.org/beautiful-taxonomy-filters/assets/icon-256x256.png?rev=1654967)
 * [Beautiful taxonomy filters](https://wordpress.org/plugins/beautiful-taxonomy-filters/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/beautiful-taxonomy-filters/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/)
 * [Active Topics](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/reviews/)

 * 15 replies
 * 4 participants
 * Last reply from: [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/automatically-submit-filters/#post-5993305)
 * Status: resolved