怎么把ul下边的某个li放到第一个位置

$('#user-order-list').find('li').each(function () {

                    if($(this).data('id')==shushe_id){            
            
                if($(this).find('img').length<=1){

                    $(this).find('a').append("<img src='../img/books_list.jpg' class='books_list_icon'>");
                    $(this).eq(0);
                }

            }else {
            }
        });

在插如图片后,下一步移动位置不知道该怎么操作了


慕哥6287543
浏览 487回答 1
1回答

慕姐4208626

这是你要的功能?$('#user-order-list').find('li').each(function&nbsp;()&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;if($(this).data('id')==shushe_id){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if($(this).find('img').length<=1){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).find('a').append("<img&nbsp;src='../img/books_list.jpg'&nbsp;class='books_list_icon'>"); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$('#user-order-list').prepend($(this)); &nbsp;&nbsp;&nbsp;&nbsp;}else&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;} });
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript