How to code button to keep runing The problem is that it stops after one click

Greetings
I try to write code that each time a button is pressed a number is added to the text
The problem is that it stops after one click
How can I make the action continue with every click
Please help

export function button4_onclick(event, $w) {

let selectedQuantity = Number(event.target.value);
$w( ‘#text10’ ).text = String(Number($w( ‘#text8’ ).text) + 1 );
}

Hi,

I don’t understand where the $w( ’ #text8 ’ ).text is updated in each click with +1, otherwise it make sense that each click $w( ’ #text10 ’ ).text will remain the same.

Best,
Sapir

Thanks for the response
I’m really new to programming and got lost in all the articles
How do i update?
I try to write code that each time I click the button
The number in “text10” will increase by 1 but the number in “text10” should start with the number found in “text8”
how do I do it

// For base 10
$w( ’ #text10 ’ ).text = (Number($w( ’ #text 10 ’ ).text) + 1 ). toString() ;

thank you it give me the idea how to solve my problem