[EDIT] Thanks for the help from prasadam and Vijaypa, I solved the problem of creating borders. However, another issue is not completely resolved. I apologized for not letting me know. My question is after dynamically creating a table. You can see that there are 5 horizontal borders (see the figure below). I want to assign an identifier to each horizontal border. For example, I want to dispute the upper bound with identifier 0; the second upper bound is the id of 1, etc. However, I do not know how to do this. Hope someone can help me.

HTML:
$(document).ready(function() { var table = document.createElement('table'); for (var i = 0; i < 4; i++){ var tr = document.createElement('tr'); var td1 = document.createElement('td');
.deco { border: 1px solid black; } table { border-collapse:collapse; border: 1px solid black; } table, td, th { border: 1px solid black; padding: 10px 20px; }
<!DOCTYPE html> <html> <head> <link type="text/css" rel="stylesheet" href="code.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <script type="text/javascript" src="code_js.js"></script> </head> <body> </body> </html>
source share