Closed dertuxmalwieder closed 9 years ago
chosen('destroy') seems to trigger chosen:hiding_dropdown which causes imageSelect to run in an error.
chosen('destroy')
chosen:hiding_dropdown
While I don't quite understand what the line span.find('img').remove() - does it lack a semicolon, maybe? - is intended to do, here's my quick fix:
span.find('img').remove()
$this.on("chosen:hiding_dropdown", function(e, _c){ chosen = $this.data('chosen'); if (chosen) { var options = chosen.form_field.options; var selected = $(chosen.form_field).find(':selected'); if(!selected) return; var img_src = selected.attr('data-img-src'); if(!img_src) return; var template = html_template.replace('{url}',img_src); // For multiple selection span = $(chosen.container).find('.chosen-choices span').last() span.find('img').remove() span.prepend(template.replace('{class_name}','chose-image')); // For single select span = $(chosen.container).find('.chosen-single span') span.find('img').remove() span.prepend(template.replace('{class_name}','chose-image-small')); } })
chosen('destroy')
seems to triggerchosen:hiding_dropdown
which causes imageSelect to run in an error.While I don't quite understand what the line
span.find('img').remove()
- does it lack a semicolon, maybe? - is intended to do, here's my quick fix: