Encountering a problem with setting the class for each li in a group of li tags:
function pathContents(fileList)
{
var $list = $('<ul/>');
$.each(fileList, function (_, file) {
$('<li/>').prop('class', 'test123');
$('<li/>').text(file).appendTo($list);
});
return $list;
}
Upon checking the Inspector in Firefox and inspecting one of the li's, the className property shows an empty string: https://i.sstatic.net/ZtMuT.jpg
Although there is a CSS rule indicating that the font should be blue when using the class test123, it remains black. It seems like the code is not assigning the class 'test123' to the li tags. Attempts such as
$('<li/>').attr('class', 'test123');
have yielded the same result as using .prop(). Why is this happening?