How to add a class to the webform error message When people fill in incorrectly in my webform, the error message will output as follow, e.g:

&lt;div class="alert alert-block alert-danger"&gt;
  &lt;a class="close" data-dismiss="alert" href="#"&gt;×&lt;/a&gt;
&lt;h4 class="element-invisible"&gt;Error message&lt;/h4&gt;
 &lt;ul&gt;
  &lt;li&gt;Name* field is required.&lt;/li&gt;
  &lt;li&gt;Email field is required.&lt;/li&gt;
  &lt;li&gt;Contact No. field is required.&lt;/li&gt;
  &lt;li&gt;Comment field is required.&lt;/li&gt;
 &lt;/ul&gt;
&lt;/div&gt;


Now, I wonder is there way I can add a CSS class to this message so that I can target this particular message that fired by this particular webform. e.g

&lt;div class="alert alert-block alert-danger webform"&gt;
 ........
&lt;/div&gt;


or even more specific, add the ID to the message .e.g 

&lt;div class="alert alert-block alert-danger" id="message-webform-client-block-212"&gt;
  ....
&lt;/div&gt;
I think the short answer is no, since the errors set in the error message box could come from any source, meaning the errors in that &lt;div&gt; aren't necessarily just your webform errors. Since it looks like you're using your webform as a block I'm guessing you can't target a body class to check if you're on a particular page type either.

If you were setting your own error messages you could add a &lt;span&gt; around the message with your custom class, but that would mean bypassing the validation handling webforms provide.

One possible solution would be to use JavaScript to find &lt;li&gt; elements that have text matching the error messages you want to style and moving them to a custom container. Another could be creating a YOURTHEMENAME_status_messages() function in your theme's template.php and doing a regular expression or string comparison to output specific error messages in a separate container. This route would affect all error message using the same text though, so it could affect an error message that was not from your webform.