freeCodeCamp Challenge Guide: Target the Children of an Element Using jQuery

freeCodeCamp Challenge Guide: Target the Children of an Element Using jQuery
0

#1

Many HTML elements have children elements from which they inherit properties.

jQuery has a function called children() that allows you to access the children of whichever element you’ve selected.

Here’s an example of how you would use the children() function:

$("#left-well").children().css("color", "blue");

#2

Hi all.

Just noticed some weirdness on that page. When it first displays, the mobile phone display shows 2 target5’s in the left well. There should only be one. What’s interesting is if you comment out the line that clones target5, it removes both. Then, if you uncomment that line, you get just the one target5 in the left well, which is what it should be at the start.

So, it seems like there is some small bug in the code that renders that mobile phone device at the beginning. It’s almost like it runs off different HTML than our editor when it first loads, and then the editor takes over once we make changes. I don’t know. Just guessing on that. Btw, I’ve tried it in both Chrome and Firefox.

I know it sounds like a small thing, but that could easily confuse someone who is very new to this.
Thanks,
Ron


#3

Why is it showing two #target5 elements


#4

Hi. I seem to be a little stuck with this.
I have followed the guidelines and have, what I think, is the correct code for this exercise. However, I am getting the dreaded ‘red cross’.

To me it should be: $("#right-well").children().css(“color”, “orange”);

Can someone point me in the right direction?


#5

reset u code and do it again !


Still that dreaded Red Cross
#6

Hi Aditya, see the line number 8 of your code.
The “.clone().appendTo(”#left-well")" code has created a clone of your target 5 element on the left wall.
If you remove this line, there will be no clone of the target 5 element.
Try this.