html:
<img src="http://webmuseum.mit.edu/mobiusicons/no_image.jpg" />
css:
div.border
{
border: 2px solid #ccc;
width: 500px;
height: 500px;
}
js:
$("img").wrap('<div class="border" />');
This is my first time using the jquery wrap(). I was expecting to see the following
<div class="border"><img src="http://webmuseum.mit.edu/mobiusicons/no_image.jpg" /></div>
but wrap() didn’t change anything and I got no error. Please help. Thanks.
Your code is working absolutely fine for me. See http://jsfiddle.net/trott/9Nm3M/.
(Try changing the border thickness to 20px for confirmation if you’re not sure that it’s working.)
Perhaps you aren’t loading jQuery or something like that?