【问题标题】:combine both javascript events together not working [duplicate]将两个javascript事件结合在一起不起作用[重复]
【发布时间】:2018-12-24 18:34:04
【问题描述】:

无法将两个 javascript 事件组合在一起 两个类操作都发生在不同的点击中。

<script>
    //first event
    $("#add-product-details-video").click(function () {
        hideAlertMsg();
    });
    //second event
    $(".add-more-image").on('click', function () {
        hideAlertMsg();
    });
</script>

【问题讨论】:

    标签: javascript php jquery


    【解决方案1】:

    根据您的评论,您在多个元素选择器之间缺少逗号:

    $("#add-product-details-video .add-more-image").click(function () { hideAlertMsg(); });
    

    应该是

    $("#add-product-details-video, .add-more-image").click(function () { hideAlertMsg(); });
    

    【讨论】:

    • 谢谢,现在可以使用了
    • @manu 很高兴为您提供帮助
    猜你喜欢
    • 1970-01-01
    • 2015-06-01
    • 2022-01-17
    • 2013-05-20
    • 1970-01-01
    • 2016-02-21
    • 2013-06-07
    • 1970-01-01
    • 2016-01-10
    相关资源
    最近更新 更多