I'm trying to select all checkbox from a click event on a button, but I cannot found a way to do it propertly, here is the best code that I can think of:
<p><strong><span _="on change from <input[name='test']/> or load
put (<input[name='test']:checked/>).length into me"></span></strong> selected</p>
<button _="on click add @checked to <input[name='test']/>">Select All</button>
<input type="checkbox" name="test" />
<input type="checkbox" name="test" />
<input type="checkbox" name="test" />
<input type="checkbox" name="test" />
<script src="https://unpkg.com/hyperscript.org@0.9.11"></script>
But unfortunately its not working, it adds a checked="undefined"
on all checkboxes, all get checked, but when I uncheck some it stops working. Seems like I shouldn't use the checked attribute, maybe use the checked property thought javascript.
The solution must use the Hyperscript library ( https://hyperscript.org )