I have multiple select elements like this
<select id="changefilter" name="id"><option value="">1</option></select>
<select id="changefilter" name="price"><option value="">1</option></select>
<select id="changefilter" name="sort"><option value="">1</option></select>
I then have a jquery on change function that listens for changes made to changefilter and then submits form applyfilter like this:
jQuery('#changefilter').change(function () {
jQuery('#applyfilter').submit();
});
Problem is that it only seems to apply apply the onchange form submit to the first field, I would like this to apply to any select fields that have changed.
Rather than giving each select field a unique name and have different .change events, is there a way to have the one code listen to all the select elements?
id. It's not HTML standard. Try to give uniqueidand assign a common class to all. And then listen the event via class not id.