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

208
Visualizações
Using javascript to populate a html table

Im trying to add input where you can select different options for a location. my issue is that its messing up the table and it just does not see me new input option that i've added. I can list other files or pictures if needed.

Before

        var items = 0;
        function addItem() {
            items++;

            var html = "<tr>";
                html += "<td>" + items + "</td>";
                html += "<td><input type='number' name='idNumber[]'></td>";
                html += "<td><input type='text' name='itemName[]'></td>";
                html += "<td><input type='number' name='itemQuantity[]'></td>";

                html += "<td><select name='itemLocation[]' id='location'><option value="Shop" name="Shop">Shop</option></select></td>";

                html += "<td><input type='text' name='itemIndex[]'></td>";
                html += "<td><button type='button' onclick='deleteRow(this);'>Delete</button></td>"
                html += "</tr>";

With trying to use input with different options

Just trying to change to location button to a multiple choice selection

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you have double quotes inside your string which is breaking your template to avoid this kind of error you should use template literals its fully supported

Note it is backtick (`) not singlequote (')

see example

var value = "new entry"
var tr = `
<tr>
    <td>${value}</td>
    <td>${value}</td>
    <td>${value}</td>
    <td>${value}</td>
    <td>${value}</td>
</tr>
`
about 4 years ago · Juan Pablo Isaza Relatório
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