The example in this article describes how to use JavaScript to control a certain column of a table not to be displayed. Share it with everyone for your reference. The specific implementation method is as follows:
1. table code
2. js control based on permissions
Note: If the data is dynamic data, control the display of td after the assignment is completed, otherwise it will cause the td header control to succeed and other lines to fail
if (uname === "guest") { $("#mytable tr").each(function() { $(this).find("td").eq(7).css("display", "none"); $(this).find("td").eq(8).css("display", "none"); $(this).find("td").eq(9).css("display", "none"); $(this).find("td").eq(10).css("display", "none"); $(this).find("td").eq(11).css("display", "none"); $(this).find("td").eq(12).css("display", "none"); $(this).find("td").eq(13).css("display", "none"); }); }
I hope this article will be helpful to everyone’s JavaScript programming design.