Как добавить картинку в таблицу JS

Код:

<!DOCTYPE html>
<html>
<body>
    <table id = "mytable" border = "1">
        <tr>
            <th>Номер</th>
            <th>Картинка</th>
            <th>Опис</th>
        </tr>
    </table>
    <br>
    <form>
        <input type = "text" name="info">
        <input type = "file" name = "pic" accept="image/png, image/jpeg">
        <input type = "button" onclick="add(this.form)" value = "Додати" /> <br>
        <input type = "button" onclick="del(this.form)" value = "Видалити" />
    </form>
    <script>
        function add(form)
        {
            //ID
            table1 = document.getElementById('mytable');
            row1 = table1.insertRow(table1.rows.length);
            cell1 = row1.insertCell(row1.cell.length);
            cell1 = row1.rowIndex;
            //Picture
        }
    </script>
</body>
</html>

ID сделал, описание сделаю, а вот как вставить картинку? Помогите, уже 2 часа зависаю на этом


Ответы (1 шт):

Автор решения: Beka
let img = document.createElement('img');
img.src = "ссылка";
row1.appendChild(img);
→ Ссылка