*include this in the page where you have the form* <script> jQuery(function(){ jQuery(".error").prev().css({"border":"1px solid red"}); }); </script>
*There is a css way for doing this (but not all browsers support css siblings ~* <style> .error~input, .error~select, .error~textarea { border: 1px solid red; } </style> On Mon, Jan 16, 2012 at 6:25 PM, David <da...@styleflare.com> wrote: > Sorry for not being clear; > > I meant if the field has an error obviously. > > After form validation, the ie. input would have an error class > > This would be useful for styling the fields with say "red borders" > > Alternatively if there is generic way to handle this I would appreciate it. > > Thanks. > > > > > On 1/16/12 2:26 PM, Massimo Di Pierro wrote: > >> Why do you want to add an "error" class to the input? The error class >> is normally used for inputs. Perhaps I do not understand. >> >> On Jan 15, 7:40 pm, David<da...@styleflare.com> wrote: >> >>> I was thinking about the form validation. >>> >>> I thought that it may be useful to include an "error" class on the input >>> widget when the form is submitted and has invalid data. >>> >>> ie. >>> >>> from >>> >>> <divclass="w2p_fw"> >>> <inputid="auth_user_password"**class="password"type="**password"value=""name="p >>> assword"> >>> <divid="password__error"class=**"error"style="display: block;">too >>> short</div> >>> </div> >>> >>> to >>> >>> <divclass="w2p_fw"> >>> <inputid="auth_user_password"**class="password >>> error"type="password"value=""**name="password"> >>> <divid="password__error"class=**"error"style="display: block;">too >>> short</div> >>> </div> >>> >>> Notice the error is the class of the input. >>> >>> I think this would be very useful and don't think it would break any >>> backwards compatibility. >>> >>> Thanks. >>> >> > -- Bruno Rocha [http://rochacbruno.com.br]