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');  } 

http://api.jquery.com/is/

or ===

if (t.get(0) === s.get(0)) { //<--compare dom elements instead of jquery object's     console.log('again yes'); } 

demo --> http://jsfiddle.net/mohammadadil/thjgn/1/


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -