I'm trying to add a value of checked for specific elements.
function renderList() {
$.getJSON("/search", function(response) {
$.each(response, function(index, value) {
$('ul').append($('<li>')
.append(value.task)
.append('<input type="checkbox"/>')
.append('<span>x</span>'))
})
});
}
I would like to add a conditional statement for the checkbox value of "checked"
When I add .attr('checked', true), it is added to the li and not the checkbox.