jQuery .each css is not a function

后端 未结 3 1524
走了就别回头了
走了就别回头了 2021-01-13 07:09

I have an jQuery object with 3 members:

var elements = $(\"#\" + this.wrapperName + \">ul>li>a>img\");
Object { 0: , 1: , 2         


        
3条回答
  •  别那么骄傲
    2021-01-13 07:55

    You have to wrap it in the jquery format. Like so:

    elements.each(function(index, element) {
        $(element).css({
            "width": elemWidth,
            "height": elemHeight,
            "top": elemTop,
            "left": elemLeft
        });
    }
    

    notice the:
    $(element)

提交回复
热议问题