DEV Community

Alexander Zaytsev
Alexander Zaytsev

Posted on • Originally published at shoonia.site

Velo by Wix: Query selector for child elements

Image description

Get the child elements inside a parent node. In this post, we take a look deeper at $w() selector and try to filter children elements by the specific parent node

Let's suppose we have a few containers with checkboxes in each of them. We don't know how many checkboxes will be in each container at the final design.

Each container has a "select all" named checkbox that allows us to check on/off all checkboxes into a current target container.

We want to provide a good abstract solution for avoiding hard coding of elements' ID. And ensure scaling for any count of the elements in the future.

Wix Editor - Example of two groups with checkboxes<br>

In general, we need to find a way to query select all child elements into a specific parent node. There are exist similar selectors in DOM and CSS.

More: Blog Post

Top comments (0)