LOOP HELP!

I have created a test page and on this test page there is a ‘Refresh’ button that when clicked I would like it to only show ‘x’ number of input boxes when ‘x’ is input in the number of players.

My code…
export function refresh_click() {
let total = +($w(‘#players’).value);
for (let i=1, i<total, i++){
total = i;
$w(‘#input${total}’).expand();
}
}
the test page is…
www.therandomquiz.com/blank

Thanks

Hi Eaton,

The loop should look something like this:

export function refresh_click() {
	let total = $w('#players').value;
	for (let i = 1; i <= total; i++){
		let x = "#input" + i;
		$w(x).expand();
	}
}

I hope this helps.

Good luck,

Yisrael

Thankyou! It worked!
I should be able to adapt this to many situations on my website.
Thanks again!

Glad I could help. It gives me the “warm fuzzies”. :smiling_face: