Giving Style to an Appended Div Element
Posted by
Malmadork on
Apr 30, 2019; 4:39am
URL: https://support.nabble.com/Giving-Style-to-an-Appended-Div-Element-tp7603398.html
Hello. I tried using another support forum to add a rank system into my forum. However I would like to change the color of the text within post_count_js.
Here is my code:
<override_macro name="post_count_js">
<n.param_loop. param="postCount">
<n.if.not.page_user.is_deactivated>
<then>
var $div = $('div.post-count<n.page_user.user_tag_id/>');
$div.html('<n.one_or_many n="[n.page_user.post_count_value/]" one_text="[t]post[/t]" many_text="[t]posts[/t]"/>');
$div.append("<br/>");
var postCount = <n.page_user.post_count_value/>;
if (postCount > 200)
$div.append("Elite Member");
else if (postCount > 100)
$div.append("Guru");
else if (postCount > 50)
$div.append("Master");
else if (postCount > 25)
$div.append("Helper");
else
$div.append("Newbie");
</then>
</n.if.not.page_user.is_deactivated>
</n.param_loop.>
</override_macro>
I already tried using `$div.style = 'color: blue' `however that did not work.
How can I change the color of each $div.append so they are different per rank? Thank you!