+ 2

How do I assign a name for the button? I'm trying to input a name and have the button display that name.

https://code.sololearn.com/W2ANyiYUVx22/?ref=app

22nd Aug 2019, 11:40 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar
3 odpowiedzi
+ 5
var s=""; for (var i=0; i<2; ++i) { s2+=i+1; s+=button(s2,l); } document.write(s); function button(id,label) { var s="<button id=\""+id+"\">"; s+=label+"</button>"; return s; } var s2="b"; var l=prompt("Enter label:"); You can use it
23rd Aug 2019, 6:10 AM
🇮🇳Abhay Pratap Singh🇮🇳
🇮🇳Abhay Pratap Singh🇮🇳 - avatar
+ 1
Thanks
23rd Aug 2019, 1:52 AM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar
0
Really? You can assign a value for a tag in js?
23rd Aug 2019, 7:22 PM
SolomonDavid Akesoba
SolomonDavid Akesoba - avatar