How to Add multiple Multi State box in a page

I want to add three Multi State Box into a single page in my website and I have written a code for one multi State box and it is working fine. But when I have added one more multi state box into that page and written a same code. But it is not showing for second one.
Kindly suggest me how shall I code the given below code to get multiple Multi state box in a Page.

code:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady( function () {
//TODO: write your page related code here…
setTimeout(() => {
$w(“#PreloaderStateBox”).changeState(“Intro1”)
}, 9000)

$w(“#button9”).onClick(() => {
$w(‘#PreloaderStateBox’).changeState(“Expanded1”);
});
$w(“#button20”).onClick(() => {
$w(‘#PreloaderStateBox’).changeState(“Intro1”);
});
});

$w.onReady( function () {
//TODO: write your page related code here…
setTimeout(() => {
$w(“#statebox1”).changeState(“state1”)
}, 9000)

$w(“#button22”).onClick(() => {
$w(‘#statebox1’).changeState(“state3”);
});
$w(“#button23”).onClick(() => {
$w(‘#statebox1’).changeState(“state2”);
});
});

Can you describe what exactly fails to work?

I have written one code for Multi State Box and it is working fine.
the code is:
$w.onReady( function () {
//TODO: write your page related code here…
setTimeout(() => {
$w(“#PreloaderStateBox”).changeState(“Intro1”)
}, 9000)

$w(“#button9”).onClick(() => {
$w(‘#PreloaderStateBox’).changeState(“Expanded1”);
});
$w(“#button20”).onClick(() => {
$w(‘#PreloaderStateBox’).changeState(“Intro1”);
});
});

BUT I WANT TO ADD ONE MORE MULTI STATE BOX INTO THE SAME PAGE

for which the code is:
$w.onReady( function () {
//TODO: write your page related code here…
setTimeout(() => {
$w(“#statebox1”).changeState(“state1”)
}, 9000)

$w(“#button22”).onClick(() => {
$w(‘#statebox1’).changeState(“state3”);
});
$w(“#button23”).onClick(() => {
$w(‘#statebox1’).changeState(“state2”);
});
});

NOW HOW TO WRITE THIS BOTH CODE AS A ONE SO THAT BOTH WILL WORK WHEN THE WEBSITE IS LOAD.

Thanks in Advance

Your current code should work as is (assuming that you wrote the element properties correctly).
But to write it even better you can put all the onClick() functions inside a single $w.onReady().
No need to have more than one $w.onReady() per page.