BTW- This method can be applied to any css property.
<script>
$(function() {
$("div.variant-width").each(function() {
var myclass = $(this).text();
var mytarget = $(this).parent();
switch (myclass) {
case "big":
mytarget.css("width", "50%");
break;
case "mid":
mytarget.css("width", "33.33333%");
break;
case "small":
mytarget.css("width", "25%");
break;
default:
break;
}
});
});
</script>
Whenever possible, use Class Names to target the elements in your interaction. You never know when you'll need to duplicate and use it somewhere else...