PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Adding JS Listeners

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Here's what I'm trying to do:

Hide/show various filter sections depending on what categories are selected.  The css and javascript should be easy enough.  The problem I'm having is that I can't add any listeners to the category selectors/inputs/label/anything.

in the footer for the page:

jQuery(document).ready(function(){

jQuery('.woof_checkbox_label').click(function(){

alert('clicked!');

});

});

I have tried changing the selector to various things.  Using general selectors like jQuery('div') will display the alert.

 

Are the checkboxes created with javascript?  Could it be that they are created after this footer script runs and so they don't exist yet?  I'm really stuck.

 

The script is part of functions.php:

function this_footer_script_function() {
if (is_page ('Shop')) {
?>
<script>

//the rest of the script has been redacted for web-posting

jQuery('label.woof_checkbox_label').click(function(){
alert('clicked!');
} );

</script>
<?php
}
}
add_action('wp_footer', 'this_footer_script_function');

Hello

this event is already defined -  wp-content\plugins\woocommerce-products-filter\js\html_types\checkbox.js https://c2n.me/47uxZ5z.png

you can check pressed checkboxes - jQuery('.woof_checkbox_term[checked="checked"]')

That will tell me which boxes are checked, but won't allow me to run a function WHEN they are checked.  I originally tried

 

jQuery('.woof_checkbox_term_104').change(function(){

});

Do you also have listeners on the <input> checkboxes?

I added the following to the footer:

jQuery('input').on('change',function(){
alert('clicked!');
} );

 

It shows an alert for every input change (search text, slider value, etc),  ..except for the checkboxes.

 

Also, after doing a bit of research, it seems that jQuery allows multiple event listeners for the same event, and runs them on after another.

Hello

Try  to  disable  this JS  lib - https://c2n.me/47vOQd9.png

it seems that jQuery allows multiple event listeners - Please  check  it - https://c2n.me/47vPevH.png - I think it can turn off your events

, but won't allow me to run a function WHEN they are checked. - after each application of the filter, the form is redrawn.  This script will work well after reloading the page.   If  you  use  ajax - https://products-filter.com/actions-ajax-filtering-done/

That all makes sense! Thank you!  I disabled the radio/checkboxes skin.  Works now!  (I do not use ajax except to recalculate count.)

Hello

Welcome;)