开发者

How to change li position using Jquery

i want to make a function that foreach time the function is called the first li at the top will be the last one so the first example will look like this

<ul>
<li id="2">
<li id="3">
<li id="4">
<li id="5">
<li id="6">
<li id="7">
<li id="1">
</ul>

Thanks


$('li:first').appendTo('ul');

working example (click anywhere): http://jsbin.com/izize3/1


Try this:

var firstChild = $("ul > li:first-child");
firstChild.appendTo(firstChild.parent("ul"));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜