I'm new to jquery and I have a question about how i can save the input from my checkboxes in an object when clicking on a button. For now i just want it to see it in the console. my code looks something like this:
let UserInput = [];
const addUserInput = (ev) => {
ev.preventDefault();
let TextInput = {
Name: document.getElementById('exampleInputName').value, //this is working
InfoElektronik: $('#Info-Elektronik').click(function() { //this is not?
console.log("Checkbox1 = " + $('#Info-Elektronik').prop('checked'));
});
};
};
<div class="form-check">
<input class="form-check-input" type="checkbox" name="agree" value="" id="Info-Elektronik">
<label class="form-check-label" for="defaultCheck1">Elektronik</label>
</div>