I am currently facing an issue where my jQuery code successfully appends a piece of HTML, but the CSS styles are not being applied to it after the append operation.
What is the correct approach to resolve this?
This is the method I am using:
if(listone[i] != "")
{
var l1pos = listone[i];
$('ul.ulstep1 li').eq(i).addClass('selected');
$line1= '<div class="tagless ';
$line2 = i;
$line2='><div class="tagleft"></div><span>';
$line2 += listone[i];
$line3 = '</span><div class="tagright"></div></div>';
$('.quiztags').append($line1+$line2+$line3);
$('.quiztags').append($('<div></div>').attr('class', 'tagless'));
}
Although the above code generates the expected HTML output, there seems to be no styling applied. I have placed this operation within a JavaScript onload function, so theoretically, the CSS should have been loaded before this is executed, right?