I have got the following jquery code which appends some html elements to the <a> tag found inside a <li> tag.
Currently, i am hardcoding the class of the <ins> tag, but actually i need to pass a javascript variable (selected_class) as the the class name.
if (colour[1] == "blue"){
selected_class = "colour-icon1";
}
else if (colour[1] == "yellow") {
selected_class = "colour-icon2";
}
else if (colour[1] == "green") {
selected_class = "colour-icon3";
}
$j("li[name='"+node_name+"'] > a").append('<a><ins class="colour-icon1"> </ins></a>');
My question is how do i pass a javascript variable (selected_class) as the the class name inside the <ins> tag?