Reputation: 106
I have a table with a cell that has two
buttons in it and a slash between them like
function insertRow (label) {
var list = document.getElementById('list');
var row = list.insertRow();
var cell1 = row.insertCell(0);
var slash = document.createTextNode('/');
var upButton = document.createElement('button');
var downButton= document.createElement('button');
upButton.innerHTML = "Up";
downButton.innerHTML = "Down";
cell1.style.borderBottom = "2px solid black";
cell1.style.borderLeft = "2px solid black";
cell1.appendChild(upButton);
cell1.appendChild(slash);
cell1.appendChild(downButton);
}
The last 3 lines of this function do what I'm looking for but to me it doesn't seem like to correct way to do this. This is my first DOM scripting project.
Upvotes: 1
Views: 620
Reputation: 329
We all live in the world of, "As long as the code works, it's good". However, few suggestions:
Upvotes: 1