8. Changing Your Style


I cannot figure out what is wrong with my code! Can anyone help?

$(document).ready (function (){
    $("div").height ("200px");
    $("div").width ("200px");
    $("div").css ("border-radius", "10px");

This returns the error:

"Oops, try again. Make sure to use the .height() function in your code."




Its your spacings before the (

Try like this:

$(document).ready(function (){
    $("div").css("border-radius", "10px");


Thanks! I read on w3schools that white space doesn't matter in jQuery. Do you know if this is true? As I have found that it does seem to matter in this course.


Hmm, good question in certain places yes it does matter some places it doesn't..

Codecademy's checker is a bit particular.

I would say stick without the ect whitespaces...

I would prefer you read w3.org or the official jQuery site


Only thing that I can see and grant it, I'm a student here too, is that there is an extra space between the method names and the parentheses for their argument; example .height ("200px"); verses .height("200px");

Some text editors add actual content other than a blank space in its place. If you produced your jQuery in a text editor first and then pasted it into this course's browser environment, perhaps some unintended information was also transported in the process. At the least try removing those three extra spaces after the three method names; height, width and css, as well as the one before the border-radius value in the css method's argument.


On reading the additional replies above, it seems likely that Zain... hit upon the issue. It seems that Codecademy's environment is very particular when it comes to expected syntax structure.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.