[英]Hide product on add to cart click woocommerce
I am using woocommerce addons to get users to upload pdfs on the product. 我正在使用woocommerce插件来吸引用户上载该产品的pdf 。 After they have clicked ' add to cart ', and submitted a pdf, I would like to hide the ' file upload ' input and the product.
他们点击“ 添加到购物车 ”并提交pdf文件后,我想隐藏“ 文件上传 ”输入和产品。
I am looking at document.getElementsByClassName
and have some kind of event listener but not sure how to complete the function. 我正在查看
document.getElementsByClassName
并具有某种事件侦听器,但不确定如何完成该功能。
Any help would be greatly appreciated. 任何帮助将不胜感激。
jQuery(document).ready(function(){
jQuery('.single_add_to_cart_button').on('click', function(event) {
jQuery('.single-product').toggle('hide'); });
});
Try using hide() function: 尝试使用hide()函数:
jQuery(document).ready(function(){
jQuery('.single_add_to_cart_button').on('click', function(event) {
event.preventDefault();
jQuery('.single-product').hide(); //or jQuery(this).parent('.single-product').hide();
jQuery(this).hide();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.