Skip to content

Instantly share code, notes, and snippets.

@nauvalidzi
Created July 14, 2023 04:38
Show Gist options
  • Select an option

  • Save nauvalidzi/53876ed6363440f7c53d7c051ca44d91 to your computer and use it in GitHub Desktop.

Select an option

Save nauvalidzi/53876ed6363440f7c53d7c051ca44d91 to your computer and use it in GitHub Desktop.
// edit select option with select2
$('#column').append(`<option value="${res.data.id}" selected>${res.data.text}</option>`);
// addnew radio or checkbox
$('#form').find('input[name=gender]').removeAttr('checked');
// addnew radio or checkbox
$(`input[name=gender][value=${data.gender}]`).prop('checked', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment