Hide an element when clicked in jQuery

JavaScript
// jQuery

What it does

This snippet will hide the element with ID buttonID when it is clicked.

There is a 250ms transition included to smoothly fade out the element.

The Code

$(document).ready(function() {
	$('#buttonID').click(function() { // Replace 'buttonID' with your element's ID
		$(this).hide(250);
	})
});

How To Use It

Paste this snippet into a JavaScript file that is loaded by your page, or you can put it between <script> </script> tags in the footer.

jQuery is required.

Menu