8. Changing Your Style


#1

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."

Help!


#4

Hey,

Its your spacings before the (

Try like this:

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

#5

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.


#6

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


#7

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.

Update:

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.


#8

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