Welcome everyone! I am relatively new to CSS and jQuery. In my project, I'm using different CSS classes based on certain conditions within a loop.
if(get_node_details[i]['node_status'] == "ONLINE")
{
var panel_color = ".panel panel-primary";
if(get_node_details[i]['node_type'] == "SECONDARY")
{
var panel_color = ".panel panel-info";
}
else if(get_node_details[i]['node_type'] == "STAND_ALONE")
{
var panel_color = ".panel panel-success";
}
I am assigning CSS classes to JavaScript variables and generating dynamic HTML content on the same page.
var text = "";
text = text +
'<div class="col-xs-12 col-sm-4 col-md-3 col-lg-3">\
<div id="panel_id_'+node_index+'" class='+panel_color+'>\
</div>
However, I'm facing an issue where the class is not being applied to the panel depending on the condition. I would appreciate any help or advice on this matter!