简体   繁体   中英

click element 2 times with clone().appendTo()

i need help i can't click the same element with 2 different classes

 $(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

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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