title: Conditionally add class using jQuery
body: <p>What is the best practice way to conditionally add a class to an element?  One option is a if statement, and then add the class.  Another option is to add the class or add an empty string as a class.  Maybe there are better options?  Yea, I know speed is probably not important, but I just wish to know the "professional" way of doing this.</p>
  
  <pre><code>var addClass=1; //or 0
  var row=$('#cloneElement')
    .clone(false)
    .removeClass('gone')
    .removeAttr('id')
    .attr('data-id',this.id);
  
  if (addClass) {
    row.addClass('newClass');
  }
  
  var addClass=1; //or 0
  var row=$('#cloneElement')
    .clone(false)
    .removeClass('gone')
    .removeAttr('id')
    .attr('data-id',this.id)
    .addClass(addClass?'newClass':'');
  </code></pre>