Hiding table data using

前端 未结 10 1120
轻奢々
轻奢々 2020-12-15 16:22

So, I\'ve hidden whole tables like this, which works fine:

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 16:39

    Yes, you can hide only the rows that you want to hide. This can be helpful if you want to show rows only when some condition is satisfied in the rows that are currently being shown. The following worked for me.

Test Table
Sample Table

In CSS, do the following:

#row2{
    display: none;
}

#row3{
    display: none;
}

In JQuery, you might have something like the following to show the desired rows.

$(document).ready(function(){
    if($("#row1").val() === "sometext"){  //your desired condition
        $("#row2").show();
    }

    if($("#row2").val() !== ""){   //your desired condition
        $("#row3").show();
    }
});

提交回复
热议问题