Set whether the table border should be collapsed into a single border or not with JavaScript?

JavascriptWeb DevelopmentFront End Scripts

To set whether a table border is to be collapsed, use the borderCollapse property and set it to collapse. You can try to run the following code to set the table border to collapse −


Live Demo

<!DOCTYPE html>
      <table id="newTable" border="2">
      <button onclick="display()">Click to collapse</button>
         function display() {
            document.getElementById("newTable").style.borderCollapse = "collapse";
Published on 27-Feb-2018 05:53:22