Check if select2 input exists before destroy
Avoiding TypeError of accessing property ‘data’ on an undefined error. This error occurs when destroying an editable with input type select2 before the select2 has been created.
This commit is contained in:
parent
f32802f48a
commit
804f4f5521
8
src/inputs/select2/select2.js
vendored
8
src/inputs/select2/select2.js
vendored
@ -294,9 +294,11 @@ $(function(){
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
if(this.$input.data('select2')) {
|
||||
this.$input.select2('destroy');
|
||||
}
|
||||
if(this.$input) {
|
||||
if(this.$input.data('select2')) {
|
||||
this.$input.select2('destroy');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user