Jan 10, 2012

11 notes

$.wrap();

This snippet just saved my day. I’m trying to build a website which my mom can update (without CMS, just because). I need her to be able to just insert images, after which the site should update the markup automaticly. 

Wrap does exactly what you would expect from it: wrap an element you target with an other tag. $(“#yourel”).wrap(“<div />”); will result in <div><yourel /></div>.

I needed this to wrap my image tags with div tags, so jQuery Masonry would function correctly.

  1. peeke posted this
About
Creative Blog by Peeke Kuepers

You can contact me at peekuep@gmail.com You can subscribe via RSS.