jQuery objects of the same element are not equal? -
this must i'm overlooking, please @ following page , javascript , tell me why, that's holy, jquery won't return true?
html: http://alcatel.scottbuckingham.com/reporting/test.html
<p class="test">hello1</p> js: http://alcatel.scottbuckingham.com/reporting/_scripts/collapse.js
;(function($, window, document, undefined) { var t = $('.test'); var s = $('.test'); console.log(t); console.log(s); if (t === s) { console.log('yes'); } })(jquery, window, document); i've literally spent hours trying work out , reduced this, 1 === 1statement won't work.
any highly appreciated!
try - working demo --> http://jsfiddle.net/mohammadadil/thjgn/
if(t.is(s)) { console.log('yes'); } or ===
if (t.get(0) === s.get(0)) { //<--compare dom elements instead of jquery object's console.log('again yes'); }
Comments
Post a Comment