Here is what I am attempting to achieve: for loop inside the append is not working
Below is my code:
$('body').append(
$('<section>').append(
$('<form>')
.attr('class', "ac-custom ac-checkbox ac-cross")
.attr('autocomplete', "off")
.append(
$('<h2>')
.html(
"Your to do list to uniquely deploy cross-unit s:"
),
function() {
options = ["ONE", "TWO", "THREE", "FOUR"];
var $container = $('<ol></ol>');
$.each(options, function(val) {
$container.append($('<li>').append(
$("<input>").attr('id', "cb" +
val)
.attr('name', "cb" + val)
.attr('type', "checkbox"),
$("<label>").attr('for', "cb" +
val).append(
$('<span>').html(
"Quickly incentivize impactful actions"
)
)
));
})
return $('<ol>').html();
}
)
)
)
Error:
jquery-2.1.1.js:5089 Uncaught TypeError: elem.replace is not a function
Where did I go wrong?