Adding and removing classes to/from HTML elements is super-easy with jQuery. Here is a quick tutorial that explains how it’s done. The code snippets are copy & paste friendly, so you can grab, gulp, and go.
Here is a simple jQuery technique to fade out any element on the page. It uses jQuery’s .hide() method to animate the fade-out of the specified element.
Quick jQuery code snippet to get the number of paragraphs in the specified element. The technique can be modified easily to get the number of any element.
Here are a few choice code snippets to truncate text with jQuery. Useful for fine-tuning responsive layouts, or just truncating strings of text in general.
When you load a page that contains a form, it may be useful to automatically place the user’s cursor in the first form field. This post explains how to do autofocus with jQuery.
Here is the basic code required for making a simple image slider. It provides a good starting point for rolling your own sliders, carousels, and so forth.
This code snippet is taken from my plugin, User Submitted Posts. It displays a link that users may click to add another file-upload input field.
This jQuery script displays a live preview of the currently selected images, as selected from a file input field.
jQuery makes it easy to do all kinds of cool stuff. For example, here is a code snippet to reload the current page with a click.
Internet Explorer has a nasty habit of displaying honking blue borders on linked images. This post shows a quick way to disable them using a slice of jQuery.
Here is a jQuery function for automatically setting the height of Ajax-loaded content.