How to change javascript for loop criteria? Newbie question
<p>Javascript newbie here, just trying to tweak this bit of code. It checks for all HTML elements with a title attribute and adds the class 'tooltipParent'.</p>

<p>I'd like it to only add the class to elements with a title attribute AND the class 'tooltip'. I think I need to add something to the <em>for</em> loop to check for this extra class?</p>

<pre><code>// loop through all objects with a title attribute
var titles=$('[title]');

// use an efficient for loop as there may be a lot to cycle through
for(var i=titles.length-1;i&gt;-1;i--){

   // titled object must be position:relative
   $(titles[i]).addClass('tooltipParent');

}
</code></pre>

<p>Thanks!</p>
