I have the following code which add a span on a json error:
if (json['error']['firstname']) {
$('#shipping-address input[name=\'firstname\']')
.after('<span class="error">' + json['error']['firstname'] + '</span>');
1) But how add a class to the input field and to the Firstname (example: color:red;) if there is an json error and
2) then remove both (style classes and span class) if the field is filled in ?
Thanks in advance for helping.