You missed a # in the color sintax:
$(this).css('background-color', '000000');
Should be:
$(this).css('background-color', '#000000');


-----Mensagem Original----- De: "Ron" <ron.ce...@gmail.com>
Para: "jQuery (English)" <jquery-en@googlegroups.com>
Enviada em: sábado, 17 de janeiro de 2009 22:13
Assunto: [jQuery] Changing bg color of cell does not work in firefox 3 (works in ie7)



When I click on the green cell (td.commsion), its color changes to
black. It works fine in IE.
In FF the bg color does not change (I do see the console.log message).
Any idea why?

Here's the code:
<script src="../js_lib/jquery-1.2.6.min.js" type="text/javascript"
charset="utf-8"></script>

<script type="text/javascript">
  $(document).ready(function() {
$("td.commision").click(function(){
if (window.console) {
console.log("Changing td color!");
}
$(this).css('background-color', '000000');
});
});
</script>
</head>

<body>
<table style="border-style:solid; border-width:1px; border-
color:#000";>
 <tr>
   <td>&nbsp;</td>
   <td class="commision" style="background-color:#0F0">&nbsp;</td>
   <td>&nbsp;</td>
 </tr>
 <tr>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
 </tr>
</table>

</body>

Reply via email to