JavaScript
Article
By Sam Deering

jQuery Wrap All Images on Page

By Sam Deering

Simple jQuery code snippet to wrap all images on a web page into a div which contains a class for formatting. The jQuery wrap() function can be used to wrap any elements on a page with any html code.

--ADVERTISEMENT--

jQuery(document).ready(function($) {
	$("img").each(function() {
		$(this).wrap('
'); } });
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account