Check for element equality in an animation function.

Posted by Zardoz on Stack Overflow See other posts from Stack Overflow or by Zardoz
Published on 2011-01-07T10:45:00Z Indexed on 2011/01/07 10:53 UTC
Read the original article Hit count: 145

Filed under:
|
|

I have the the below code and would expect that in the first pass of the fadeTo function "yes" would be printed as those first two console logs tell me it is the same element. But it doesn't recognize them as equal. What do I miss here?

var tds = self.element.find("td:nth-child(" + (columnIndex + 1) + ")");
tds.fadeTo(options.columnFadeOutTime, 0, function() {
  window.console.log(tds.first());
  window.console.log($(this));
  if ($(this) == tds.first()) {
    window.console.log("yes");
  }
  else {
    window.console.log("no");
  }
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery