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 pleaseIf 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.
Quote from LeeFeeMarket on May 13, 2020, 06:28Here'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');
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');
Quote from Pablo Borysenco on May 13, 2020, 13:24Hello
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"]')
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"]')
Quote from LeeFeeMarket on May 13, 2020, 16:44That 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?
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?
Quote from LeeFeeMarket on May 14, 2020, 01:07I 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.
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.
Quote from Pablo Borysenco on May 14, 2020, 14:00Hello
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/
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/
Quote from LeeFeeMarket on May 14, 2020, 20:36That all makes sense! Thank you! I disabled the radio/checkboxes skin. Works now! (I do not use ajax except to recalculate count.)
That all makes sense! Thank you! I disabled the radio/checkboxes skin. Works now! (I do not use ajax except to recalculate count.)