Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
How can I make multiple inputs every time I enter an input?

I am creating a google extension called manga extension. It all went well until I crossed with input. I like to put an input number every time I enter a manga name in the main input, naming it with chapter with input. But when I enter a new manga name, the value of every input I entered is lost. And I don't know how to put it inside of localStorage. How should I make it?

const divInput = []
const mangaName = document.getElementById('mangaNameInList')
// the manga name
const deleteBtn = document.getElementById('deleteBtn')
let mangaChapters = document.createElement('input')
let mangaLists = document.getElementById('mangaLists')
// the div i created in html
let count = 0
mangaName.addEventListener('keyup', function (event) {
    if (event.key == 'Enter') {
        count += 1
          mangaLists.innerHTML += `<p> ${mangaName.value} 
          <em>chapter</em>
          <input type="number" class="mangaChapters ${count}" 
          onkeyup="getValue(event)">
          </p>`
          // the input that i was conflicted with
       }
})

function getValue(event) {
    if (event.key == 'Enter') {
        mangaChapters = document.getElementsByClassName(`mangaChapters`)
        divInput.push(mangaChapters.value)
    }
}

every time I entered the main input (mangaName) and displaying it in the innerHTML, I just concatenate it with

and and that's the problem, how can I get the value of every declared input that I make in inside the mangaName?

<!DOCTYPE html>
<html lang="en">
<head>
       <meta charset="UTF-8">
       <meta http-equiv="X-UA-Compatible" content="IE=edge">
       <meta name="viewport" content="width=device-width, initial- 
       scale=1.0">
       <link rel="stylesheet" href="style.css">
       <title>Manga Extension</title>
</head>
<body>
       <h1>Manga Name Lists</h1>
       <input type="text" id="mangaNameInList">
       <button id="deleteBtn">DELETE ALL</button>
       <div id="mangaLists"></div>
       <script src="script.js"></script>
</body>
</html>

here's the html code. thanks for taking time to answer my coding question :)))

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda