Forums Forums Search & Filter Pro Dropdown isn't working when changing search through javascript

Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #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
    #96717

    I am not sure what you mean? I just tried the search and it seems to work as you wanted now?

    Anonymous
    #96720

    Does the country dropdown work for you? On mine, The county dropdown doesn’t work if you just want to search for a county.

    The rest works perfectly

    Trevor
    #96726

    The 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 be jQuery(

Viewing 4 posts - 1 through 4 (of 4 total)