/ Published in: jQuery
Selectors are ARRAYs ... so you should do something like this
$('div.a')[0] == $('div#a')[0]
or use the bellow method
$('div.a')[0] == $('div#a')[0]
or use the bellow method
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$.fn.isEqual = function($otherSet) { if (this === $otherSet) return true; if (this.length != $otherSet.length) return false; var ret = true; this.each(function(idx) { if (this !== $otherSet[idx]) { ret = false; return false; } }); return ret; }; var a=$('#start > div:last-child'); var b=$('#start > div.live')[0]; console.log($(b).isEqual(a));