Q:

Adding class to div at level above

im trying to set the panel heading to a different color by adding a class, if the panel body has any errors..
see my attempt which doesn't work....
any ideas?
 $(".input-validation-error").each(function () {

            $(this).closest('panel-default').find("panel-heading").addClass('panel-heading-error');

        });

    // rough HTML layout
        <div class="panel panel-default">
        ////stuff
           <div class="panel-heading">
           <div class="panel-body">
              <div class="input-validation-error"></div>
           </div>
        </div>
<div class="panel panel-default">
        ////stuff
           <div class="panel-heading">
           <div class="panel-body">

           </div>
        </div>

A:

Looks like you're missing some period marks to denote class...
try:
$(this).closest('.panel-default').find("div.panel-heading").addClass('panel-heading-error');
demo: http://jsfiddle.net/0g10b5d6/

