Copy codeThe Code is as follows:
$ (This). ready (function (){
$ (". Up"). each (function (){
$ (This). click (function (){
Var $ tr = $ (this). parents ("li ");
If ($ tr. index ()! = 0 ){
$ Tr. prev (). before ($ tr );
}
});
});
Var trLength = $ (". down"). length;
$ (". Down"). each (function (){
$ (This). click (function (){
Var $ tr = $ (this). parents ("li ");
If ($ tr. index ()! = TrLength ){
$ Tr. next (). after ($ tr );
}
});
});
$ ("A [name = 'up']"). click (function (){
If ($ ("input [name = 'rule']: checked"). size ()> 1 ){
Alert ("only one option can be selected for the move up operation! ");
Return;
}
$ ("Input [name = 'rule']: checked"). each (function (){
Var $ div = $ ('# rule _' + $ (this). val ());
If ($ div. index ()! = 0 ){
$ Div. prev (). before ($ div );
}
});
});
$ ("A [name = 'low']"). click (function (){
If ($ ("input [name = 'rule']: checked"). size ()> 1 ){
Alert ("only one option can be selected for the move up operation! ");
Return;
}
$ ("Input [name = 'rule']: checked"). each (function (){
Var $ div = $ ('# rule _' + $ (this). val ());
If ($ ('# rule _' + (parseInt ($ (this). val () + 1100000000.html ()! = Null ){
$ Div. next (). after ($ div );
}
});
});
});