I can add a class to a form element simply by doing something like this:
$("input").each(function() {
$(this).addClass($(this).attr("name"));
});
Essentially that grabs the form value and adds it to the element as a class. Probably fine in most cases but sometimes the values will be numbers. So that leaves me with something like this:
<input type="radio" id="amount-5" name="submitted" value="50" class="form-radio 50">
I suppose then, I could target with CSS as .form-radio.50 but it probably would be better to prepend some text in front of the added value class. Ideally
<input type="radio" id="amount-5" name="submitted" value="50" class="form-radio radio-50">
I tried:
$("input").each(function() {
$(this).addClass($('radio-class-' + this).attr("value"));
});
... and that did not work. I'm out of ideas. Here's my fiddle.