Test if two elements are the same

前端 未结 7 1454
予麋鹿
予麋鹿 2020-12-07 21:32

I would suspect this to work at first:

if ($(\'#element\') == $(\'#element\')) alert(\'hello\');

But it does not. How does one test if ele

7条回答
  •  抹茶落季
    2020-12-07 22:22

    This should work:

    if ($(this)[0] === $(this)[0]) alert('hello');
    

    so should this

    if (openActivity[0] == $(this)[0]) alert('hello');
    

提交回复
热议问题