jQuery pull text from selected facet

123 Views Asked by At

i have a facet dropdown that i have attached a class to parent div and am trying to use that to pull the selected item out and display in the h2 title of the drop down.

here is what i have

 jQuery(select, 'a').filter(function(){
           return jQuery(this).has('.facetapi-active').length > 0
       }).each(function(){
           jQuery(this).addClass('selected');
       });

this add the class to the parent of the active or selected item and this

 if (jQuery(select).hasClass('selected')){
        //alert('almost there')
          jQuery('.selected').find('h2').text('display')
      }

gets the title or h2 to read display if the class is selected but i need it for each drop down and display it for that drop only. this variable has the text but it displays same text in each h2.

var selection = jQuery('.selected .facetapi-processed').find('li').text();

How do i make specific for each i already tried jQuery(this) and got nothing?

0

There are 0 best solutions below