js-循环中判断两次点击是否是同一元素

$(elm).click(function(){

  if($(this).attr('num')){

    console.log("同一个元素")

  }else{

    for(let i=0;i<elm.length;i++){

      $(elem).eq(i).removeAttr('num')

    }

    $(this).attr('num')

    console.log("不是同一个元素")

  }

})

原文地址:https://www.cnblogs.com/huangmin1992/p/7204108.html