Button.innerText = 'hello'; = deletes the badge

If you edit the text, textContent, innerText of a button this alters the innerHTML of the button which also removed the badge, so cant set the badge Button_badge =“12” results in Button_badge not defined

This is the expected result.

If you look at the underlying HTML, Button1.innerHTML has several elements. You want refer to the specific element which has the button’s text:

Button1.children[1].innerText = "New Value";

Ah ok.

Thank for your the clarification.

How would I set the badge value ?

Button1_badge.innerText = "2";