0

I have the following JSFIDDLE, which has a main image and image nav.

I need to wrap a div around the image nav so that i can position it with CSS.

How do i add the class to my HTML?

My Example

1 Answer 1

3

the question was not clear to me but you can use wrap

$('img ').wrap('<div class="newClass" />');

http://jsfiddle.net/SgCpq/1/

EDIT

$('img').filter(function(){return $(this).width()===40;})
.wrap('<div class="newClass" />');

http://jsfiddle.net/SgCpq/5/

Sign up to request clarification or add additional context in comments.

10 Comments

P.S. you should have mentioned that you are using an iframe
the image nav are the smaller images in the JSFIDDLE example. How would the jquery know which image to wrap the new class around? and how would it know where to end?
iframe? no.. the jsfiddle uses an Iframe to display the content... my site does not use an iframe.. :s
that my friend you will have to tell the jquery :) let me see it again
i'm checking for the img that have the width ===40 you can specify your own criteria
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.