One of the functionality i like most with jQuery is the ability to add class or classes to HTML elements.

Using the addClass() method, you can add single or multiple classes to all target elements.

To add multiple classes, separate the classnames with a space.

Example

<script>
	jQuery(function($) {
		$('#green').click(function() {
			$('p').addClass('green bold');
		});
	});
</script>

Try it yourself →