문제

I have a table and I want to colorize my only 3 first row after .sortable()!

$("table tbody").sortable();
$('table').mouseup(function(){ 
setTimeout(function() {
    $("table tr:eq(1)").addClass("Color2_c Color1_b");
    $("table tr:eq(2)").addClass("Color2_c Color1_b");
    $("table tr:eq(3)").addClass("Color2_c Color1_b");
},50);});

http://jsfiddle.net/574AL/

Any suggestion to also uncolorize the following rows?

도움이 되었습니까?

해결책

I think .removeClass is what you're after:

$("table tr:eq(1)").removeClass("Color2_c Color1_b");
$("table tr:eq(2)").removeClass("Color2_c Color1_b");
$("table tr:eq(3)").removeClass("Color2_c Color1_b");

다른 팁

now that I can answer : I say :

$("table  tbody").sortable();
$('table').mouseup(function(){ 
 setTimeout(function() {
  $("table tr:eq(1)").addClass("Color2_c Color1_b");
  $("table tr:eq(2)").addClass("Color2_c Color1_b");
  $("table tr:eq(3)").addClass("Color2_c Color1_b");
  $("table tr:eq(4)").removeClass("Color2_c Color1_b");
});

http://jsfiddle.net/574AL/1/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top