Forums › Forums › Search & Filter Pro › SF Pro Removing Classes from custom select elements
- This topic has 7 replies, 2 voices, and was last updated 6 years, 3 months ago by
Anonymous.
-
Anonymous(Private) May 3, 2019 at 5:15 am #209966
I thought I might need to add the actual markup that’s being output:
<select name="_sfm_recognition_document_type[]" class="sf-input-select wide" title="" style="display: none;"> <option class="sf-level-0 sf-item-0 sf-option-active" selected="selected" data-sf-depth="0" value="">Type: All Checks</option> <option class="sf-level-0 " data-sf-count="4" data-sf-depth="0" value="BusinessCheck">Type: Business Check</option> <option class="sf-level-0 " data-sf-count="1" data-sf-depth="0" value="PAD">Type: Pre-Authorized Debit</option> <option class="sf-level-0 " data-sf-count="2" data-sf-depth="0" value="PersonalCheck">Type: Personal Check</option> </select> <div class="nice-select sf-input-select wide" tabindex="0"> <span class="current">Type: All Checks</span> <ul class="list"> <li data-value="" class="option selected">Type: All Checks</li> <li data-value="BusinessCheck" class="option">Type: Business Check</li><li data-value="PAD" class="option">Type: Pre-Authorized Debit</li> <li data-value="PersonalCheck" class="option">Type: Personal Check</li> </ul> </div>
Trevor(Private) May 3, 2019 at 9:40 am #209989If ajax is being used on the form, that will remove any classes added. The AutoCount feature does this, and I am not sure, but the general Ajax feature might also. So, test which (or both) it is. You need some custom JavaScript to reapply the classes.
This post shows the script(s) needed:
https://support.searchandfilter.com/forums/topic/re-initialize-plugin-js-swup/#post-203208
Anonymous(Private) May 3, 2019 at 9:52 am #209995So even when I disable ajax, auto count, and auto submit, it still doesn’t work as expected.
I tried adding the initialization of nice-select into the ajax complete as you mentioned also, and that didn’t work either.(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ $('#search-filter-form-19977 select').niceSelect(); }); }(jQuery));
Trevor(Private) May 3, 2019 at 9:57 am #209999mmm
The alternaitve is to use Select2, which we include with the plugin, is maintained by Automattic (via WooCommerce) and is quite good?
These two threads discuss this (many of the posts won’t be relevant to you):
https://support.searchandfilter.com/forums/topic/design/
and
https://support.searchandfilter.com/forums/topic/customise-dropdown-combobox/
-
AuthorPosts