to achieve that.
Now I have a more complex scenario. In this new table, also dynamically-generated, I have one checkbox to mark each item active or inactive (for that I'll use the above solution) and five radio buttons. I'm trying to come up with another foreach function that will give me the checked value for each item.
I'm trying to modify the original function but it will only give me 1 if the last radio button is checked for each item/line. How can I do this?
For the checkboxes, it's giving me something like this:
Which means that every item ID is active, but trying to use the same for the checkboxes gives me all IDs with values in 0. Here's the function:
let id = $(this).attr("id").replace(/\D/g,'')
sistemaCriticidadEventosNivel[id] = this.checked ? 1 : 0;
sistemaCriticidadEventosNivel = JSON.stringify(sistemaCriticidadEventosNivel);
I know I should get the value of the radio button and not 1 or 0 but my brain can't process it right now.
Any thoughts? Thanks in advance!