0
A client reported that in his IE is presenting a message that the script was too long, causing a lock.
$(document).ready(function () {
$('select').each(function () {
$(this).select2({
allowClear: true,
dropdownAutoWidth: true
});
});
});
My code above, does anyone have any suggestions?
The problem is this $('select'). each(Function(), do you really need to scan all 'selects' from the page ? this code will go through ALL selects of the page which probably causes the slowdown
– PauloHDSousa
But it enters the select each only five times as they are 5 select even.
– Fábio Freitas
I did so, I think it can improve: $('select'). Select2({ allowClear: true, dropdownAutoWidth: true });
– Fábio Freitas