如何查看 select2 实例的设置选项?
How to see the set options to a select2 instance?
我想将选项设置为 select2 实例,特别是如果 allowClear 选项设置为 true 或 false。
浏览对象时,我在
中找到了 allowClear 选项
jQuery... -> select2 -> options -> options,
但我不知道如何通过代码访问它。
你可以这样访问它
yourObjectName.jQuery(those after number).select2.options.options.allowClear
这是列出为 select2 实例设置的所有选项的方法
$(selector).data('select2').options.options
我需要 allowClear 选项,所以我的问题的答案是这样
$element.data('select2').options.options.allowClear
我想将选项设置为 select2 实例,特别是如果 allowClear 选项设置为 true 或 false。
浏览对象时,我在
jQuery... -> select2 -> options -> options,
但我不知道如何通过代码访问它。
你可以这样访问它
yourObjectName.jQuery(those after number).select2.options.options.allowClear
这是列出为 select2 实例设置的所有选项的方法
$(selector).data('select2').options.options
我需要 allowClear 选项,所以我的问题的答案是这样
$element.data('select2').options.options.allowClear