knot22 knot22 - 2 months ago 12x
jQuery Question

translation of vanilla JavaScript to jQuery

Below is a JS function:

I'd like to update this so it uses jQuery but I am having difficulty figuring out how to translate it.

function pathContents(fileList) {
var list = document.createElement('ul');
for (file in fileList) {
var item = document.createElement('li');
return list;


The jQuery equivalent "all-the-way" would be:

function pathContents(fileList) {
    var $list = $('<ul/>');
    $.each(fileList, function () {
    return $list;

But the pure JavaScript way really is not that bad. For one, you cannot beat the performance of it.