For instance, the example code below would change
<input type="submit" name="submit" value="Submit" />
to:
<input type="submit" name="submit" value="Submit" class="submit" />
jQuery.fn.attrToClass = function(attribute) { $(this).each( function(intIndex){ $(this).addClass($(this).attr(attribute)); }); }; $(document).ready(function(){ // designate the tag and the attribute to be extracted $("input").attrToClass("type"); });