Hey Ash
I’ve not tried to do what you are doing exactly but in theory it should work.
So you want to clear one field if the other field is updated?
I think what you are doing is fine, setting .val("")
.. when doing this, do you see the field itself change value? If so, then all you should need to do is submit the form (which will handle the building of the new URL) – $('.searchandfilter').submit();
– this will also work for an ajax powered search form.
What you suggested above also sounds like it might do the trick (triggering a change event after you have set the val), you might need to trigger input
or change
and then you would need to do it here in your example:
jQuery('.sf-field-taxonomy-taxonomy1 select').on('change',function(){
jQuery('.sf-field-taxonomy-taxonomy2 select').val('').trigger('change');
});
Our next major version has quite a large rewrite and will include a JS api for doing this kind of thing much more easily.
Hope that helps