<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
</head>
<body>
<p><input type="button" value="1"></p>
<p><input type="button" value="2"></p>
<p><input type="button" value="3"></p>
<script>
$(document).ready(function(){
$("p").click(function(){
var next = $(this).next();
var temp = $(this).remove();
next.after(temp);
});
});
</script>
</body>
</html>