【问题标题】:I am facing issu with select2 clear function to remove manual selected option我面临 select2 clear 功能删除手动选择选项的问题
【发布时间】:2022-02-11 16:38:38
【问题描述】:

当我手动选择选项并通过 js 清除 t 时,select2 clear 不起作用 这是我清除 select2 所选选项的功能

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

【问题讨论】:

    标签: jquery-select2


    【解决方案1】:

    试试这个

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

    而不是

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

    【讨论】:

    • 它的作品谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多