Add class to last div when it exists
<p>I have the following HTML structure, I want to add a class to the last <code>&lt;div&gt;</code> which contains the <code>&lt;p&gt;</code> tag but only when it exists. </p>

<pre><code>&lt;div id="view"&gt;
  &lt;div class="login"&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;p&gt;Add a class to this parent DIV&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Any suggestions?</p>
