简体   繁体   English

使用clone()。appendTo()单击元素2次

[英]click element 2 times with clone().appendTo()

i need help i can't click the same element with 2 different classes 我需要帮助,我无法单击2个不同类别的相同元素

 $(document).ready(function(){
        $(".hello,.ciao").on("click",function (){
        $(nera).clone().removeClass("hello").addClass("ciao").appendTo($('#dama tr 
         #'+sinistra));
        $(nera).remove();

'

The issue seems to be with this line 问题似乎与这条线有关

$(".hello,ciao").on("click", function() {

There is no selector before ciao ciao之前没有选择器

I presume it will be like this 我想会是这样

$(".hello,.ciao").on("click", function() {

Try this 尝试这个

$(document).ready(function(){
        $('.hello.ciao').on("click",function (){
        $(nera).clone().removeClass("hello").addClass("ciao").appendTo($('#dama tr 
         #'+sinistra));
        $(nera).remove();

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

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