Answers for "html select2"

0

select 2 dropdown

$('#element').select2({
    placeholder: 'Select a option',
    minimumInputLength: 3,
    ajax: {
        url: route('api.fetch-options'),
        dataType: 'json',
        type: 'GET',
        quietMillis: 50,
        data: function (params) {
            return {
                visitor_name: params.term
            }
        },
        processResults({ data }) {
            return {
                results: $.map(data, function (item) {
                    return {
                        text: item.name,
                        id: item.id,
                    }
                })
            }
        }
    }
}).change(() => {
	// perform some action on change
});
Posted by: Guest on December-19-2020
0

select2

$(".js-example-basic-multiple-limit").select2({
  maximumSelectionLength: 3
});
Posted by: Guest on February-03-2021

Browse Popular Code Answers by Language