Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to display multiple input value in JavaScript

//two input fields displayed as one
// <p>{input.value}${time.value}</p>
addBtn.addEventListener('click', () => {
    if (input.value.trim() != 0) {
        let newItem = document.createElement('div');
        newItem.classList.add('item');
        newItem.innerHTML = `
        <p>${input.value}${time.value}<p>
        <div class="item-btn">
        <i class="fa-regular fa-pen-to-square"></i>
        <i class="fa-regular fa-trash-can"></i>
    </div>
        `;
        tasks.appendChild(newItem);
        input.value = "";
    } else {
        alert('Please enter a task')
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #display #multiple #input #JavaScript
ADD COMMENT
Topic
Name
5+3 =