我面临使用 select2 clear 函数删除手动选择选项的问题

I am facing issu with select2 clear function to remove manual selected option

select2 当我手动 select 选项并通过 js 清除 t 时,清除无法正常工作 这是我清除 select2 selected option

的函数

$('#select2_id 选项').removeAttr('selected');

试试这个

$('#select2_id').val('').trigger('change);

而不是

$('#select2_id option').removeAttr('selected');