I can't give a white color for the cross of closing. JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I can't give a white color for the cross of closing. JS

https://code.sololearn.com/WXeSNo4wsaIB/?ref=app

11th Apr 2020, 1:21 PM
Pavel Durov
Pavel Durov - avatar
3 Answers
+ 4
Nice try. Here is a fix for you : https://code.sololearn.com/W3LJd59xORwm/?ref=app Here are my remarks : 1. You need [0] for getElementsByTagNames results. 2. we can use document.body, so no need to use getElement methods 3. indent your code block properly 4. appendChild does not return (edit following Omkar's correction: appendChild() does return, but not used in this way here) 5. img element cannot have child 6. insert the parent span 7. × is interpreted when it is HTML, and not working when using createTextNode or innerText If you don't understand any of the above, do let me know, I'll come back to explain.
11th Apr 2020, 1:38 PM
Gordon
Gordon - avatar
+ 6
Gordon , Minor correction , point 4 is wrong. " The returned value is the appended child (aChild), except when aChild is a DocumentFragment, in which case the empty DocumentFragment is returned. " ~MDN(https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild )
11th Apr 2020, 2:01 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
🇮🇳Omkar🕉 Oh, I didn't know this, thanks.
11th Apr 2020, 3:50 PM
Gordon
Gordon - avatar