如何将“点击”绑定到段落?

我有以下功能:

$(document).on('touchstart mousedown',"p span.text", function(e) {
                             console.log('I was clicked');
                             *more code here*
});


如果我将“ touchstart mousedown”替换为“ click”,则不再触发该功能。

PS:我是JS的超级新手,所以我可能做错了什么。

最佳答案

尝试:

    $("p span.text").on('click', function(){
          console.log('I was clicked');
    });

关于javascript - jQuery-单击不起作用,只有touchstart mousedown,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22319247/

10-12 13:28