This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source = https://github.com/select2/select2 | |
$('#select2').select2({ | |
placeholder: 'Select the product', | |
ajax: { | |
url: "https://dummyjson.com/products", | |
processResults: function ({data}) { | |
return { | |
results: $.map(data, function (item) { | |
return { |