+ 1
Can we limit document.createElement?
Document.createElement creates element. If I had onclick -> createElement, it would keep creating more elements. Can we limit it to how many it can create? Like ... if it reaches certain number, it needs to stop creating.
3 Antworten
+ 1
You can simply count up a variable and if it reaches a certain value you either remove the event listener or you block createElement with an if statement.
0
Aaron Eberhardt can you use the (i) number to limit .createElem..
can h finish this code.
https://code.sololearn.com/WmOXxGBkh8p9/?ref=app
0
Here's the fixed code:
https://code.sololearn.com/WI1t1G2c3D8B/?ref=app
Yet you should keep in mind that removing the event listener would be a cleaner solution for this problem.