Checkboxes and radio buttons

Use :checked and prop('checked'). Select-all is a classic.

jQuery · Checkboxes and radio buttonsBeginner
$('#select-all').on('change', function () {
  $('.row-check').prop('checked', this.checked);
});

$('.row-check').on('change', function () {
  const all = $('.row-check').length === $('.row-check:checked').length;
  $('#select-all').prop('checked', all);
});

const ids = $('.row-check:checked').map(function () { return this.value; }).get();   // ['1', '3']
const gender = $('input[name="gender"]:checked').val();
checkboxradiocheckedselect all