title: jquery check element is not empty change class
body: <p>When p.err is not empty I want to add the class p.err-wrapper.</p>
  
  <pre><code>&lt;p class="err err-wrapper"&gt;not empty&lt;/p&gt;
  &lt;p class="err"&gt;&lt;/p&gt;
  
  
  p.err {color:#ff0000, font-weight: bold; }
  p.err-wrapper {background:#ffffdd; border:1px solid #ff0000; }
  </code></pre>
  
  <p>The app I am using adds an error msg over a form like this <code>&lt;p class="err"&gt;&lt;?php get(error_msg) ?&gt;&lt;/p&gt;</code></p>
  
  <p>It is added to the page whether there is an error or not. As soon as there is an error <code>&lt;p class="err"&gt;Your first name is missing&lt;/p&gt;</code>, p.err decorates the contents of the <code>&lt;p&gt;</code> tag.</p>
  
  <p>I want to wrap the error in a border and a background. The problems is because <code>&lt;p class="err"&gt;&lt;/p&gt;</code>
  is not conditionally added, I get a bordered background when there it no error.</p>
  
  <p>I want to add jquery that checks if <code>&lt;p class="err"&gt;&lt;/p&gt;</code> is not empty and then add the class p.err-wrapper, i.e. <code>&lt;p class="err err-wrapper"&gt;&lt;/p&gt;</code>.</p>
  
  <p>I got it kind of working but i am so new at jquery.</p>