radius is not defined , I don't know which css attribute can refer to border radius using JavaScript . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

radius is not defined , I don't know which css attribute can refer to border radius using JavaScript .

The desired outcome is width should be 150px for img and its border radius should 50%. https://code.sololearn.com/WP304BfGAVma/#

23rd Aug 2022, 8:55 PM
Mustafa Azzoz
Mustafa Azzoz - avatar
38 Answers
+ 7
document.querySelector("img").style.borderRadius = "50%";
23rd Aug 2022, 10:40 PM
Chris Coder
Chris Coder - avatar
+ 5
Mustafa Azzoz Compliers are universal. However, in many online courses, the course software is programmed behind the scenes to take specific inputs in order to test if the case is true or not.
24th Aug 2022, 4:28 PM
Chris Coder
Chris Coder - avatar
+ 4
Mustafa Azzoz Many members do attempt to get quick answers here for homework. But we often remind them that this isn't simply a place for answers to your homework. This is a learning platform. We ask that they provide their attempt and then we may offer assistance. Like you have so I offered to help.
24th Aug 2022, 4:28 PM
Chris Coder
Chris Coder - avatar
+ 4
Mustafa Azzoz if it is possible to help, some of us will go the extra mile to help. However, it is often very difficult to help with things that are not related to this app. So we suggest post topics remain on topic, i.e. in relation to sololearn.
24th Aug 2022, 4:29 PM
Chris Coder
Chris Coder - avatar
+ 4
Thank you, but I can't take your personal account. That is a privacy concern. You shouldn't trust just anyone with your account information. Especially were currency is involved. What is the name of the course I may have already completed it.
24th Aug 2022, 4:39 PM
Chris Coder
Chris Coder - avatar
+ 4
Mustafa Azzoz Reset the code and in the app.js put this let txt = document.getElementById("container"); txt.style.textAlign = "center"; document.querySelector("img").style.borderRadius = "50%"; document.querySelector("img").style.width = "150px";
24th Aug 2022, 9:30 PM
Chris Coder
Chris Coder - avatar
+ 3
Mustafa Azzoz Now I see your question is in regard to a Udemy course. Why didn't you say so before? No wonder why you keep dodging my question to rather or not it works correctly in the sololearn app. I'm here debugging for this app. Udemy wants wants a very specific answer. This is sololearn. Perhaps someone has provided the answer for you in the Udemy community for lesson you're on.
24th Aug 2022, 3:42 PM
Chris Coder
Chris Coder - avatar
+ 3
Mustafa Azzoz in the Q/A for the lesson there were also other examples that passed document.querySelector('#container').style.textAlign='center'; document.querySelector('img').style.width='150px'; document.querySelector('img').style.borderRadius='50%';
24th Aug 2022, 9:35 PM
Chris Coder
Chris Coder - avatar
23rd Aug 2022, 10:40 PM
Junior
Junior - avatar
+ 2
Chris Coder It's because of the order in wich the elements are loaded. If you load the JS objects, functions, etc. before the HTML elements, you'd be telling your code to work with elements that don't exist (yet). So, with window.onload = function ()... You're telling your code to 1) Wait for the HTML page and its elements to be loaded first and just then: 2) Execute the scripts with the now-existing elements.
24th Aug 2022, 3:17 AM
Nico
Nico - avatar
+ 2
Mustafa Azzoz If it didn't work in the app you should have said so. I asked yesterday if it worked in the app. You and Your Mom had me thinking there was only an issue on my end. I said it required an onload function. https://code.sololearn.com/WKbNaqC0KOiu/?ref=app
24th Aug 2022, 1:59 PM
Chris Coder
Chris Coder - avatar
+ 2
About the udemy course. Is it free? If so I wouldn't mine giving my go at it. To see if I could help with the issue 😀
24th Aug 2022, 4:30 PM
Chris Coder
Chris Coder - avatar
+ 2
Mustafa Azzoz Awesome! I'm relieved that something was resolved after all of this.
24th Aug 2022, 4:34 PM
Chris Coder
Chris Coder - avatar
+ 2
Whats the Exercise number?
24th Aug 2022, 7:30 PM
Chris Coder
Chris Coder - avatar
+ 1
umm but why urs doesnt work is because for ur document with ur raidus u have .style.border-raidus. u have no equal sign and no percent thing. how it should look: .style.borderRadius = 50 + “%”;
23rd Aug 2022, 10:42 PM
Junior
Junior - avatar
+ 1
Your Mom you are right but this playground is throwing an error. Oops.
23rd Aug 2022, 10:50 PM
Chris Coder
Chris Coder - avatar
+ 1
Your Mom is your code working correctly for you in the app? Because it is not for me. But on desktop it is.
23rd Aug 2022, 10:53 PM
Chris Coder
Chris Coder - avatar
+ 1
I'm using the app on android.
23rd Aug 2022, 10:54 PM
Chris Coder
Chris Coder - avatar
+ 1
It worked on Decoder , The outcome basically must be a circle , Right ?
23rd Aug 2022, 10:55 PM
Mustafa Azzoz
Mustafa Azzoz - avatar
+ 1
Your Mom I figured it out. For some reason I have to add an onload function to your code and then it works.
23rd Aug 2022, 11:06 PM
Chris Coder
Chris Coder - avatar