I used sweetalert in my jquery web application. And I'm showing that with select box. That's sweetalert options like below.
swal({
title: 'Select field validation',
input: 'select',
inputOptions: {
apples: 'Apples',
bananas: 'Bananas',
grapes: 'Grapes',
oranges: 'Oranges'
},
inputPlaceholder: 'Select a fruit',
showCancelButton: true,
})
But, I want to disable particular select box option in that sweetalert select box.
If anybody know that solution means, Kindly share here.
Use the didOpen
method it will call after swal select box init
swal({
title: 'Select field validation',
input: 'select',
inputOptions: {
apples: 'Apples',
bananas: 'Bananas',
grapes: 'Grapes',
oranges: 'Oranges'
},
inputPlaceholder: 'Select a fruit',
showCancelButton: true,
didOpen: () => {
$('.swal2-select option:first').attr('disabled', true);
}
});