0

JS - createElement with div (workable in multiple situations)

Hi, I am trying to put a "clear" button to clear everything that would be on "inList", but since this object was created in JS (not html) I am facing some difficulties. I have tried putting the var out of the function part and creating an id, but somethings stopped working and this also didn't. Anyone that could help me understand how to solve this? And more importantly, how to have a proper id for an object created in js and how to use it further in the document multiple times. Thank you! The link is here: https://code.sololearn.com/W62U4EHusUPl/#

18th Sep 2020, 3:30 PM
Jann Basso
Jann Basso - avatar
3 odpowiedzi
+ 3
See through it whether this helps answer your doubt https://www.sololearn.com/post/90825/?ref=app
18th Sep 2020, 3:58 PM
Ipang
0
You also have a naming conflict issue with your code. With your code as-is, when the clear button is clicked nothing happens, this is due to the naming conflict between document.clear() method and your code's clear() function. Document.clear() is deprecated but it is still a property of the document at the moment. You need to rename clear(). https://code.sololearn.com/Wx5gm52YBIxu/#html
19th Sep 2020, 12:04 PM
ODLNT
ODLNT - avatar
0
@Ipang, sorry, I only had time today, but the link does not exist anymore. Could you resend please?! :) @ODLNT thanks for the tip! it worked now to put at least an alert :) i just have to check now the actual function I need
21st Sep 2020, 7:42 AM
Jann Basso
Jann Basso - avatar