Hi,
i created three function into JS tab of my filter form
First after reset form
$(".js-wpv-reset-trigger").click(function(e) {
// after reset
console.log("Reset");
});
});
Second after change select
jQuery(document).ready(function($){
$('select.my-select').on('change', function(){
console.log("Change value");
});
});
Third after filter data
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
// after reload data
console.log("Reload data");
});
All three works until I hit reset.
After the reset, no function is called again.
How can I solve it?
Regards
Hi David,
Thank you for contacting us and I'd be happy to assist.
The way your custom script blocks have been added, the first two blocks are executed when the page loads/reloads, but not once the results have updated through AJAX.
You can wrap them inside a named function and then make sure that this function is executed on page load/reload ( .ready ) and when the results have updated ( js_event_wpv_parametric_search_results_updated ).
Example:
jQuery(document).ready(function($){
combinedAction();
});
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
// after reload data
console.log("Reload data");
combinedAction();
});
function combinedAction() {
jQuery(".js-wpv-reset-trigger").click(function(e) {
// after reset
console.log("Reset");
});
jQuery('select.my-select').on('change', function(){
console.log("Change value");
});
}
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
My issue is resolved now. Thank you!