views:

44

answers:

3

right now i have this

$(".container a").css("color","#ffffff");

which styles all links inside ".container" white. then i have a div structured like this

<div class="container">
  <div class="header">
    <a href=">
  </div>
</div>

the links inside that second div only turn white in Firefox. Is there a way to fix the line of js without adding another line for the header div? Something that selects all the children?

A: 

EDIT:

my mistake, this could be a CSS issue.

EDIT 2:

do this.

put your js code just before the end of the </body> tag or any where after the calling of the module. I am assuming that you put your styling script in your header. Since firefox loads everything in hierarchal situation including the script, the script already performs the styling before the module is loaded to the DOM. So if you put the styling script at the end of the DOM, the module is already loaded before it performs the styling script.

rob waminal
This won't give any different result than doing `$(".container a")`. The two are equivalent.
patrick dw
This is equivalent to what he already has :)
Nick Craver
well the problem is they are module divs and they need to be styled through js. that's just the way this was developed.<div class="container"<a href=></a></div>works fine and makes the links white in all browsers.but for this one div i realized it calls javascript to load the module so it's like this:<div class="container"><script src=""></script></div>and then that script has a div with an unordered list in it and some anchor tags. those anchor tags only turn white in Firefox, no other browser. Is it because it's being called by the script?
Sasha
so the script inside the `<div>` you mentioned has the styling codes or it just calls some module?
rob waminal
it just calls a module and if you firebug it, it has a div with an id and a class and an unordered list with p tags and anchor tags. i'm trying to get those anchor tags white.
Sasha
@Sasha, try to see my edits.
rob waminal
it's still only working in firefox.ive got<body><div class="container"><script type="text/javascript" src="url"></script></div><script type="text/javascript"> $(document).ready(function () {$(".container a").css("color","#ffffff");});</script> </body>
Sasha
+1  A: 

It's a descendant and that should be enough. As meder mentioned it's probably a specificity issue. You could add !important or another selector .container a, .container .header a. There's probably a better way than all of those but without seeing more that's all to suggest for now.

ryan
A: 

Try fixing the html code first by closing all the tags and quotes.

<div class="container">
  <div class="header">
    <a href="#">Link</a>
  </div>
</div>

Also, make sure that you have your code execute after the page loads.

Kranu