+ 1
JS how to increase a value by x onclick
Example; div width = 10px; When u click on this button, the div width increases by 5 (15), if u click it again it increases by 5 again (20)... I'm just experimenting on this code: https://code.sololearn.com/WVMu0BA0xtR5/?ref=app
1 Answer
+ 3
Rather than increasing the value of wi within the assignment of the new width, you could just do the following:
wi = 50;
function width(){
wi += 10;
pap.style.width = wi+"px";
}