Hey guys i am not sure how to display my javascript program output in a table by not altering the html code, right now the output looked![enter image description here][1] left-aligned, i want to make the name goes underneath CUSTOMER NAME, and child goes underneath CHILD/ADULT, but right now when i added in the javascript program it does not work. thanks for your help
const MAX_CUSTOMERS = 5; //maximum customer on the trampoline is 5
var customerList = new Array(); //create new Array
function addAndDisplayCustomer() //function for add and display customer
{
var newCustomer = {}; //create new object
newCustomer.name = document.getElementById('name').value.trim(); //get name value
newCustomer.childOrAdult = childOrAdult.options[childOrAdult.selectedIndex].value; //get option value for child or adult
displayCustomers(); //display customers
}
function displayCustomers() //function for display customers
{
if (message = '')
message = '[There are currently no customers on the trampoline]'; // no customer on the trampoline
else
{
var message = '<p><b> CUSTOMER NAME </b>\t\t<b> CHILD/ADULT </b></p>';
for (var i = 0; i < customerList.length; i++)
{
message += ' '+ String(customerList[i].name) + '; //name message
message += ' + String(customerList[i].childOrAdult) + ' //status message
message += '<button onclick="removeCustomer(' + i + ')">Remove this customer</button></td></tr>'; //add delete button
}
}
document.getElementById('outputDiv').innerHTML = message; //display message
}