简体   繁体   English

Javascript单击事件未在所有类元素上运行

[英]Javascript click event not running on all class elements

I have a button of class 'add' which, when clicked simply clones itself and its other div siblings. 我有一个类'添加'的按钮,当点击时只需克隆自己和其他div兄弟。 The cloning works fine, however the click functionality only works on the first instance of the button (the one that loads with the page) and not on any subsequent instances. 克隆工作正常,但点击功能仅适用于按钮的第一个实例(与页面一起加载的实例),而不适用于任何后续实例。

Any help would be great. 任何帮助都会很棒。

$('.add').click(function(){
        cloneDiv();
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM