The Finished Code
Here it is, the finished code for the contact form:
$(document).ready(function() { // enhance style of form elements $('fieldset').each(function(index) { var heading = $('legend', this).remove().text(); $('<h3></h3>') .text(heading) .prependTo(this); }); var requiredFlag = ' * '; var requiredKey = $('input.required:first').next('span').text(); requiredKey = requiredFlag + requiredKey.replace(/^\((.+)\)$/,"$1"); var conditionalFlag = ' ** '; var conditionalKey = $('input.conditional:first').next('span').text(); conditionalKey = conditionalFlag + conditionalKey.replace(/\((.+)\)/,"$1"); $('form :input').filter('.required') .next('span').text(requiredFlag).end() .prev('label').addClass('req-label'); $('form :input').filter('.conditional') .next('span').text(conditionalFlag); $('<p></p>') .addClass('field-keys') .append(requiredKey + '<br />') .append...