jQuery .css not working at all : the following code is not working correctly

$("p").css("background-color", "yellow");
alert( $("p").css("background-color"));

the alert is "undefined". 

I tried on both google chrome and firefox. I have extracted this from the w3c website and in their example it works (I am even using the same jQuery version)
