0

I am trying to construct a variable like the following:

var feed = new Instafeed({
    get: 'tagged',
    tagName: 'Breakfast',
    clientId: 'bff2c0f300c841a298a9198e499eee16',
    limit: 50,
    target:'instagramFeedBottom',
    template: '<li class="panel"><a href="{{link}}"><img class="front card" src="{{image}}" /></a><a href="{{link}}"><div class="back card"><p>{{model.user.full_name}}</p></div></a></li>',
    after: function() {
        RandomImg();
    },
    resolution: 'low_resolution'
});


    $('.front').on({
        mouseenter: function () {
            var x = $(this).parent().parent();
            console.log(x + $('.back'));
        }
        // mouseleave: function () {
        //    $(this).fadeIn(medium);
        // }
    });

I am having the following error in the console: [object Object][object Object]. I need to access the '.back' based on the '.front'.parent().parent()

1
  • console.log(x.find('.back')); Commented Feb 25, 2014 at 12:03

2 Answers 2

1

Since x is a jQuery object use .find() like

console.log(x.find('.back'));
Sign up to request clarification or add additional context in comments.

Comments

1

I think you need The context selector

$('.back', x)

OR

You can also use

x.find('.back')

Note: jQuery internally converts $('.back', x) to x.find('.back')

2 Comments

Why x is after as x suppose to be .panel?
@ArunPJohny thanks for that , although I was looking for an explanation to the fact my (wrong) solution didnt work console.log(x + $('.back'));.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.