keviinC
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
CSS class applied to search filter label disappears after AJAX update
Started by: keviinC
in: Toolset Professional Support
Problem: I have a custom search View that updates with AJAX. When the page loads, I use custom JavaScript to apply custom CSS classes to the parent label of a checkbox if it is checked. When the View is updated with AJAX, the CSS class disappears. Solution: AJAX updates overwrite not only the results of a View but also the filters. You must apply the CSS class again after the AJAX update by inspecting the checkbox and determining whether or not it is checked. jQuery(document).ready(function () { // add class to label when input changes jQuery(document).on('click', 'input', function () { if (jQuery(this).is(':checked')) { jQuery(this).parent().addClass('done'); } else { jQuery(this).parent().removeClass('done'); } }); // After ajax load, loop over replaced inputs and re-apply parent element classes if needed jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function(event,data) { jQuery('input').each(function (index, item) { if (jQuery(item).is(':checked')) { jQuery(item).parent().addClass('done'); } }); }); }); |
3 | 6 | 6 years, 4 months ago |
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
CSS class applied to search filter label disappears after AJAX update
Started by: keviinC
in: Toolset Professional Support
Problem: I have a custom search View that updates with AJAX. When the page loads, I use custom JavaScript to apply custom CSS classes to the parent label of a checkbox if it is checked. When the View is updated with AJAX, the CSS class disappears. Solution: AJAX updates overwrite not only the results of a View but also the filters. You must apply the CSS class again after the AJAX update by inspecting the checkbox and determining whether or not it is checked. jQuery(document).ready(function () { // add class to label when input changes jQuery(document).on('click', 'input', function () { if (jQuery(this).is(':checked')) { jQuery(this).parent().addClass('done'); } else { jQuery(this).parent().removeClass('done'); } }); // After ajax load, loop over replaced inputs and re-apply parent element classes if needed jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function(event,data) { jQuery('input').each(function (index, item) { if (jQuery(item).is(':checked')) { jQuery(item).parent().addClass('done'); } }); }); }); |
3 | 6 | 6 years, 4 months ago | ||
Add relationship 1 to the url before related title
Started by: keviinC in: Toolset Professional Support |
2 | 2 | 6 years, 7 months ago | ||
Woo templates
Started by: keviinC
in: Toolset Professional Support
Problem: Solution: Relevant Documentation: |
2 | 3 | 6 years, 7 months ago |