8/14 Possibly a typo?


#1

Hey there again, working through the unit but I've been stopped getting an error of
"Oops, try again. Did you give your

a border-radius of 10px? It looks like its border-radius is 0px."

My code is as follows:
$(document).ready(function () {
$('div').height('200px');
$('div').width('200px');
$('div').border-radius('10px');
});

According to the css tab, the border radius is still 0px, but if I edit it via that route, it doesn't accept as it's an exercise on the script.js. Any ideas? Am I typing it wrong? I've tried a variation of .border-radius, .radius, .borderRadius, etc. Not sure what's up with it. Anyone see the error?


#2

have you tried using

$("div").css("border-radius","10px");

do a google search as it might also be a Browser specific problem
border-radius() site:jquery.com


#3

That worked! Thank you Leonhard, sometimes all it takes is another perspective.


#4

This too works pretty well.
$(document).ready(function(){
$("div").css({"height":"200","width":"200","border-radius":"10px"})

})


#5

Thanks! worked for me to using Mozilla Firefox.


#6

this also worked no idea why..... did this in the firefox browser:

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

});


#7

So you can pass a JSON object like the post by @jawshooah or make multiple method calls like what is outlined in the lesson though a nice trick for readability is to write them out as follows (*only one semicolon is needed as well as omitting the selector in every call) :
$('div')
.height('200px')
.width('200px')
.css('border-radius', '10px);

I would also have each property in it's on line if you choose to got the JSON route, just to make things easier to read. It might not seem like a big deal, but readability becomes important when you share your code or are working with other people on the same codebase.