Reputation: 7001
In the below code, the css style "onred" is not honoured. The css is loaded before this javascript runs ... any ideas? The result is a standard href without the styling.
<script>
$.each(parent.j25d169030c6580e7ad7cc5d785cf5fa8.userMenu, function(name, url) {
if (name == "logout") {
$('<li><a id="logout" href="' + url + '" class="onred">' + name + '</a></li>').appendTo('ul#navMenu');
} else {
$('<li><a href="' + url + '" class="onred">' + name + '</a></li>').appendTo('ul#navMenu');
}
});
</script>
Upvotes: 0
Views: 291
Reputation: 53890
CSS is always 'honoured'. Doesn't matter which runs first or when.
Execute the code and then inspect the new DOM elements. Is there a class="onred"
present? If there is and it's not styled the way you want, it's your CSS that's incorrect.
Upvotes: 1
Reputation: 490637
Your selector may no longer be valid.
Use an inspection tool such as Firebug to see clearly where the element resides and craft your selector to suit.
Upvotes: 1