как установить и отключить флажок в ячейке таблицы после проверки статуса как true с помощью api и

#javascript #jquery

Вопрос:

 $(document).ready(function(){
    document.getElementById('fetchtodosBtn').addEventListener('click', fetchTodos);
    
    function fetchTodos(){
        fetch('https://jsonplaceholder.typicode.com/todos/')
            .then(response => response.json())
            .then(todos => {
                  let output = "";
                //  adding todos titles into a table with checkboxes 
                output  = "<table>";
                todos.forEach(function(todos) {   
                    output  = "<tr>";
                    output  = `
                        <td>
                        <input class='checkbox'  type='checkbox' name='checkbox'/>

                        </td>

                        <td>
                            ${todos.title}
                        </td></tr>
                    `;
                });
                output  = '</table>'
                document.getElementById("response").innerHTML = output;
            });
    }

});
 

Комментарии:

1. Привет, можешь показать todos результат ? console.log(todos) Вы увидите результат внутри консоли браузера.