Remove spaces from an input using code

I want to create an input box, a text box and a button such that the user inputs data into the input box and when they click the button the text box contains the information entered but without spaces
eg
Input box: “Los Angeles”
After button click…
Textbox: “LosAngeles”

I understand that I will put the code into an OnClick Event handler for the button, but just not sure about the code to use.

Thanks

Hi,
You can use the function replace to remove all spaces :

$w('#buttonID').onClick((event)=>{
	let str = $w('#textID').text;
	 $w('#textID').text = str.replace(/\s/g,'');  
});

Good luck,
Tal.