我想隐藏或显示我的select2,但我在API中找不到方法.我正在使用一种解决方法,隐藏父级,如下所示:
$(document).on('change', '.country', function () {
if ($(this).val() == $(this).data('current-countryCode')) {
$('#states').parent().show();
}
else {
$('#states').parent().hide();
}
});
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有人可以提供帮助,或者是否在API中存在这样的方法.