DOM issue, I guess ?! | Sololearn: Learn to code for FREE!


DOM issue, I guess ?!

I created a webpage to convert an RGB color to hex and vice versa .. js code works I'm kinda sure of that, ot was a challenge in the first place and I finished it (only js codes).. but when created this page it doesn't for some reason.. any help would be appreciated

6/24/2020 1:53:51 PM

Ali Kh

3 Answers

New Answer


var result = document.querySelector('#res').innerHTML; <-- This is your problem The variable result is a string instead of the HTMLHEADING object you need to display results of the toHEX() and toRGB() functions. var result = document.querySelector('#res'); result.innerText or textContent


Ali Kh It is the small problems that bite us in the butt most of the time.😉 I'm glad I could help.


Thank you a lot.. all is clear now😃, previously I stored the element 'text' in the variable.. so no change was done on the element itself. A small issue, yet made the whole code fail😬 Again, thanks for your help 🙏