我有一些按钮。像这样:
one
two
three
four
five
six
如果点击two
和six
,订单会更改为:
one
six
three
four
five
two
答案 0 :(得分:0)
我这样做了:
$(document).ready(function(){
var change ="a";
$("button").bind("click",function(){
if(change == "a"){
$(this).attr("id",change);
change =$(this).text();
}else{
$("#a").text($(this).text());
$(this).text(change);
change ="a";
$("#a").removeAttr("id");
} })
})

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<button>one</button>
<button>two</button>
<button>three</button>
<button>four</button>
<button>five</button>
<button>six</button>
&#13;