+ 1
I can't give a white color for the cross of closing. JS
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.
+ 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 )
+ 2
š®š³Omkarš Oh, I didn't know this, thanks.