If you have a very large dropdown in an html page – say a few thousand items, and you want to clear all of them, then using jQuery .empty() function is very slow. In most cases, it will hang the browser. The fastest way is to use native javascript.
So instead of
$('#mydropdown').empty();
use
document.getElementById('mydropdown').items.length = 0;
Leave a Reply