wonder of its possible to add the x-data and event to the container of the chceckbexes and let it bubble up to keep track of count, so that way it doesnt have to be added to all the individual checkboxes?
Yeah that is possible! I tried that first and it worked fine but you could basically click anywhere under the div container and it would count as a "click". I thought that kind of defeated the point cause it doesn't feel like it's actually counting box clicks. When I added it to the boxes directly and saw it only incurred another ~0.2kb I figured it was worth it.
i love this combination htmx with alpineJS
wonder of its possible to add the x-data and event to the container of the chceckbexes and let it bubble up to keep track of count, so that way it doesnt have to be added to all the individual checkboxes?
Yeah that is possible! I tried that first and it worked fine but you could basically click anywhere under the div container and it would count as a "click". I thought that kind of defeated the point cause it doesn't feel like it's actually counting box clicks.
When I added it to the boxes directly and saw it only incurred another ~0.2kb I figured it was worth it.
should be able to check if it's a checkbox and increment, maybe something like
x-on:click="$event.target.type === 'checkbox' && count++"
Oh that's a really good idea! I think that would work and cut down on markup payload size. Will try it.