jQuery objects of the same element are not equal?

前端 未结 5 1637
梦毁少年i
梦毁少年i 2021-01-17 23:39

This must be something I\'m overlooking, but please look at the following page and JavaScript and tell me why, for everything that\'s holy, jQuery won\'t return true?

<
5条回答
  •  醉酒成梦
    2021-01-18 00:07

    You can use the jQuery is method.

    Description: Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.

    if (t.is(s)) {
        console.log('yes');
    }
    

    Example fiddle: http://jsfiddle.net/IrvinDominin/q86Sh/

提交回复
热议问题