I'm having some trouble distinguishing why exactly one method works and the other one doesn't. I have a workable solution by using .eq() but wanted to understand properly why I can't call the .css method using the [] notation if it still returns an object?
Here is my test code, tried to figure it out myself:
$('.slider').each(function() {
var $slides = $('.slide');
console.log(jQuery.type($slides.eq(1)));
console.log(jQuery.type($slides[2]));
$slides.eq(1).css( {color: 'red'} );
$slides[2].css( {color: 'red'} );
});
console logs tell me that both selectors are returning an object. So why do I get a typeError on the [] notation like it isn't an object?
Appreciate any clarification.
Thanks,