Forums › Forums › Search & Filter Pro › Dropdown isn't working when changing search through javascript
- This topic has 3 replies, 2 voices, and was last updated 7 years, 9 months ago by Trevor.
-
Anonymous(Private) March 14, 2017 at 11:22 am #96607
Hi Trevor,
Apologies for starting another thread about this!
After going off to find how to reset the search through javascript, i saw that someone else has already asked about this before and used the code below to reset the search.
I’ve added this to my page and it seems to be working like i wanted it to. However, the county dropdown isn’t working independently now.
Can you help me?
(function ( $ ) { "use strict"; jQuery(document).on("sf:ajaxstart", ".searchandfilter", function(){ var tax1 = jQuery('.sf-field-taxonomy-regions select').val(); if(location.search.search('_sft_regions='+tax1) == -1) { jQuery('.sf-field-taxonomy-counties select').val(""); } }); }(jQuery));
Trevor(Private) March 14, 2017 at 3:51 pm #96726The county dropdown you mean (not country)?
Ah, no it doesn’t 🙁
Which means something is wrong with that code. Not sure what though. I do not understand what it is doing.
You can usually find some good code snippets by searching on StackExchange. Something like this in Google (haven’t tried it though):
stackexchange jquery reset select to default whenever another select is changed
Note that solutions often use
$(
when in jQuery they ought to bejQuery(
-
AuthorPosts