const input_number = document.querySelector("#input-number");
const output = document.querySelector("#output");
const btn_submit = document.querySelector("#btn-submit");

function print_mult_table(number)
{
    let str = "";
    for (i = 1; i <= 9; i++)
    {
        str += `${number} x ${i} = ${number * i}<br>`;
    }

    const temp = document.createElement("div");
    temp.innerHTML = str;
    
    // clear old result
    output.textContent = "";

    output.appendChild(temp);
}

btn_submit.addEventListener("click", (event) => {
    const number = input_number.value;
    print_mult_table(number);
});
