Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAbhijit Das
5,022 PointsElement checkbox before label 'confirmed'
How could I create and append element checkbox before label 'confirmed' ?
5 Answers
Steven Parker
231,248 PointsIf you wanted to place the checkbox before the label instead of inside it:
// label.appendChild(checkbox); // instead of doing this
li.appendChild(checkbox); // do this instead
Abhijit Das
5,022 PointsSamuel Cleophas yes he is indeed...Steven Parker beside awesome teachers at tree-house, we learn loads of stuffs from the community because you guys are here..thank you all.
Abhijit Das
5,022 PointsHi Steven Parker I tried it here...
https://codepen.io/Abhijeet_dasdezine/pen/LLMqEZ?editors=1010
however I want to get that Label for click and get input checkbox selection; like if i click on confirmed checkbox will select. It's not happening in this case.
Steven Parker
231,248 PointsSee the comment added to my answer.
Abhijit Das
5,022 PointsSteven Parker thank you :)
Steven Parker
231,248 PointsGlad to help. Happy coding!
Abhijit Das
5,022 PointsSteven Parker done sir
Steven Parker
231,248 PointsSteven Parker
231,248 PointsOh, you didn't really want it before the
label
element itself, just before the text in the label:label.insertBefore(checkbox, label.firstChild);
Samuel Cleophas
12,348 PointsSamuel Cleophas
12,348 PointsYou are an actual genius. I see all your answers and comments everywhere are they are extremely helpful every single time!!