Adding class to elements

Adding class to elements

I want to add a class to every input field that is the same as the type attribute value and an id that is the same as the name attribute value (so I can properly target them with CSS across all browsers).

I thought this would be right but I guess not cuz it doesn't do anything.

$("input").addClass($(this).attr("type"));
$("input").attr("id", $(this).attr("name"));