Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!