Joe Isaacson
Joe Isaacson

Reputation: 4132

Insert element inside a div with jquery

I have 6 images that page using .cycle

The main image is under the #up div that is automatically generated, but I want to add the .thumbnail class to the #up image or insert it

$(function() {
        $('#up').after('<ul id="slide">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 0,
            pager:  '#slide',
            pagerAnchorBuilder: function(idx, slide) {
                return '<li><a href="#"><img src="' + slide.src + '" width="100" height="100" /></a></li>';
            }
        });
        $('#up').children('img').addClass('.thumbnail');
    });

Here is the page I am working on if you want a good chuckle -

http://homeplan.com/HPS%20LP/work.html

Joey

Upvotes: 0

Views: 618

Answers (1)

You almost got it right, when using addClass() you don't need to type the typically starting dot for classes, so do like this:

$('#up').children('img').addClass('thumbnail');

Upvotes: 2

Related Questions