How to get work javascript(eventListener) code on Yith Quick View
-
Hi,i have this code on my single product template (i use elementor theme constructor) which works on each product except on quick view modal.
document.getElementById('pa_tailleattrape').addEventListener('change', function () { document.getElementById('text-60b79227e1fae').setAttribute('maxlength', this.value); el = document.getElementById('pa_tailleattrape').value; if (el == 6) { document.getElementById('text-60b79227e1fae').placeholder = 'Entrer au maximum 6 lettres'; } if (el == 9) { document.getElementById('text-60b79227e1fae').placeholder = 'Entrer au maximum 9 lettres'; } });i didn’t find a way to activate this code on yith quick view plugin.
I tried several things, the last one is this:
if ( !function_exists( 'yith_wcqv_customization_trigger_quick_view_on_product_click' ) ) { add_action( 'wp_enqueue_scripts', 'yith_wcqv_customization_trigger_quick_view_on_product_click', 99 ); function yith_wcqv_customization_trigger_quick_view_on_product_click() { $js = "document.getElementById('pa_tailleattrape').addEventListener('change', function () { document.getElementById('text-60b79227e1fae').setAttribute('maxlength', this.value); el = document.getElementById('pa_tailleattrape').value; if (el == 6) { document.getElementById('text-60b79227e1fae').placeholder = 'Entrer au maximum 6 lettres'; } if (el == 9) { document.getElementById('text-60b79227e1fae').placeholder = 'Entrer au maximum 9 lettres'; } })( jQuery );"; wp_add_inline_script( 'yith-wcqv-frontend', $js ); } }Can you suggest a fix for this? Thank you.
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘How to get work javascript(eventListener) code on Yith Quick View’ is closed to new replies.