+ 1

Coding problem

Hey guys... What's wrong with my code?? It dosent create button after the comments became more than five??? Please help! https://code.sololearn.com/WHM4X1bIt5gb/?ref=app

18th Aug 2020, 2:07 PM
Shaghayegh
Shaghayegh - avatar
5 Antworten
+ 4
X always remains 0, it never increases coz its insids the function. Each time you click the button, the function runs inside which u have written x = 0 So write that outisde the function And you can't select body tag using getElementById, there is a simple way, document.body.appendChild() so u dont need to make a variable for that.
18th Aug 2020, 2:14 PM
maf
maf - avatar
+ 3
Gordon thanks for your help🙏
18th Aug 2020, 2:54 PM
Shaghayegh
Shaghayegh - avatar
+ 1
Gordon i have another question if you can answer... instead of prompt which tool or function i can use? and its better?
18th Aug 2020, 3:48 PM
Shaghayegh
Shaghayegh - avatar
+ 1
Shaghayegh Hp Good question, prompt() is for absolute beginner to understand basic input/output. To provide a user interface for user, use the input element. Then in JavaScript, get element and then use inputElement.value to access it. Lesson one and four of my To-do List series discuss the use of input element and its related event listeners. Here is link to the unfinished series: https://www.youtube.com/playlist?list=PLkqwj9vc20pUitqvZrLPk-hTNv63EJqwg
18th Aug 2020, 5:01 PM
Gordon
Gordon - avatar