JSFiddle - React, Tailwind, and code Playground
HTML
<div id="profile-list">
</div>
JavaScript
var classes = ['email-checkout', 'absc', 'random', 'brrrr'];
for(var i = 0; i < 2000; i++){
$('<input />').attr({
type: 'checkbox',
class: classes[Math.floor(Math.random() * classes.length)],
checked: (Math.random() > .5)
}).appendTo('#profile-list');
}
var checkboxLength = 'Checkbox length: ' + $('.email-checkout').length;
// Original (minus the table bit)
var start = (new Date()).getTime(),
elements = $("#profile-list input[type=checkbox].email-checkout:not(:checked)");
$.each(elements, function(i) {
$(elements[i]).attr('checked', 'checked');
});
var now = (new Date).getTime(),
originalRunTime = 'Original: ' + (now - start);
// Reset
$("#profile-list :checkbox.email-checkout").each(function(){
this.checked = (Math.random() > .5);
});
// New
start = (new Date).getTime();
$("#profile-list :checkbox.email-checkout").each(function(){
this.checked = true;
});
var now = (new Date).getTime(),
newRunTime = 'New: ' + (now - start);
$('body').empty().append(checkboxLength + ' ' + originalRunTime + ' ' + newRunTime);