RsD0p9BK
4/4/2014 - 12:31 PM

Check if Element Exists http://css-tricks.com/snippets/jquery/check-if-element-exists/

// Tiny jQuery Plugin
// by Chris Goodchild
$.fn.exists = function(callback) {
  var args = [].slice.call(arguments, 1);

  if (this.length) {
    callback.call(this, args);
  }

  return this;
};

// Usage
$('div.test').exists(function() {
  this.append('<p>I exist!</p>');
});