I have to compare two selectors and I was wondering why does this return false in firebug...and how do I compare two selectors
$('.product-info:last') == $('.product-info:last')
this is what I have to do
var previous = $('.product-info:visible');
if(previous == $('.product-info:last')){
return false;
}
The reason $('.product-info:last') !== $('.product-info:last')
is because jQuery create a new object for each one of those, they are not the same jQuery object.
Use is instead to check if elements are the same.
previous.is('.product-info:last')
try :
$('.product-info:last').get(0) == $('.product-info:last').get(0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With