Answer the question
In order to leave comments, you need to log in
How to create an object in an array when a checkbox is clicked?
Each checkbox block has its own id and each checkbox has its own key. It is necessary that when a checkbox is selected, it is added to the filters array as an object {'filterId': id, 'value': ''}
. If a checkbox is unchecked, then it is removed from this array
As a result, by clicking on the "View" button, you need to get an array of objects of the selected checkboxes
Answer the question
In order to leave comments, you need to log in
Checkboxes have such attributes true-value and false-value, and put your object in them, it will be assigned to a variable.
UPD: I lied a little. You can stick an object directly into value
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question