Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Little Filter Question
- This topic has 5 replies, 2 voices, and was last updated 3 years, 1 month ago by
Ernest Marcinko.
-
AuthorPosts
-
April 25, 2023 at 3:13 pm #42300
Ivo
ParticipantHello,
I have a question about the filters
First of all, thank you for this fantastic addon!
I have created a search and use in it a filter with a dropdown menu with ZIP codes.
Is there a way to read the ZIP code (text) clicked by the user via javascript ? I would like to use this value in the search bar before the settings icon. The CSS is not the problem. Unfortunately I didn’t find anything in the javascript documentation that works.Basically I would like to build the searchbar from https://pixabay.com/.
Thanks a lot and best regards, Ivo
April 26, 2023 at 4:48 pm #42307Ernest Marcinko
KeymasterHi,
Do you have any specific setup I can take a look? This might be possible somehow via a script, by fetching the value from the filter and probably adding an element hovering or something like that. However I will have to take a look at the setup to be able to suggest from there.
April 26, 2023 at 7:11 pm #42310Ivo
ParticipantYou cannot access this content.
April 27, 2023 at 12:33 pm #42325Ernest Marcinko
KeymasterThank you Ivo.
I may have found a possible solution, I changed the custom CSS a bit so that the “::after” tag has a content fetched from a data attribute. Then I added this custom script:
jQuery(function ($) { $('.asp_m .prosettings .innericon').attr('data-text', 'Alle'); $('.asp_m .prosettings').one('click', function () { setTimeout(function () { $('.asp_select_label select').on('change.asp_select2', function () { let id = $(this).closest('.asp_w').data('id'), inst = $(this).closest('.asp_w').data('instance'), val = $(this).val() == '__any__' ? 'Alle' : $(this).val(); $('.asp_m_' + id + '_' + inst + ' .prosettings .innericon').attr('data-text', val); }); }, 500); }); });It should hopefully work. I can’t guarantee anything for 100% since this is a customization, but it should be okay for most cases.
-
This reply was modified 3 years, 1 month ago by
Ernest Marcinko.
April 27, 2023 at 4:28 pm #42333Ivo
ParticipantHi Ernest,
absolute GREAT – thx for this support – works as I wished 😉
Thx & Best,
IvoApril 27, 2023 at 4:33 pm #42334Ernest Marcinko
KeymasterYou cannot access this content.
-
This reply was modified 3 years, 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.