I'm making an image gallery with custom buttons, and this is the functionality I'm trying to make:
You click a button, it hides all images in the container, then shows one image from the container.
This is the code I wrote for it:
export function button1_onclick(event) { $w("#box1").children.hide(), $w("#image1").show()
}
Error: Property 'hide' does not exist on type '(Element & AnyProperties)[]'.
Its working in preview mode, but I'm assuming this error is whats making it break on the live version.
If anyone could help I'd really appreciate it- this is my first time doing any coding to my site.
Thanks!
Hi there,
You're not following @Certified Code Global's suggestion correctly, you're passing the same specific element to hide for each loop cycle, children are site elements with IDs, pass each ID to a selector and hide it.
$w('#box').children.forEach(element => $w(element.id).hide());
Hope this helps~!
Ahmad