How do I initiate each different type of input and select elements since I submit it?

Viewed 24

enter image description here

let typeValue =  [];
let namedValue =  [];
let dateValue = [];
let amountValue =  [];
let optionsValue =  [];

submit.addEventListener('click',expense)

function expense(e) {
    e.preventDefault();    

    let tr = document.createElement('tr');    
    expenseTable.append(tr);

    let td = document.createElement('td');   
    tr.append(td);
    td.innerHTML = `${typeValue}`;

    createElement(namedValue);
    createElement(dateValue);
    createElement(amountValue);
    createElement(optionsValue);

    function createElement(a) {
        td = document.createElement('td');     
        tr.append(td);
        td.innerHTML = a;    
    } 
        
    //❓question

}

hello. I'm making Expense Tracker. and working on putting the data on the below line when I click submit.

How do I make input and select elements empty since I submit them???

1 Answers
Related