Do you know how to properly reduce this code?
I have this code to submit the form with name="search" on the change events of any of this select menus: categories, price, and range). The code is working but it doesn't seem very correct because it has some repetition. Do you know how to properly reduce the code?
- $(document).ready(function() {
- $('select[name="categories"]').on('change', function() {
- $('form[name="search"]').submit();
- });
- $('select[name="price"]').on('change', function() {
- $('form[name="search"]').submit();
- });
- $('select[name="range"]').on('change', function() {
- $('form[name="search"]').submit();
- });
- });