We’ve all experienced it – we’ve populated a listbox and there are blank items. Of course, the best way to fix this is to fix the data. However, let’s say you have a deadline and need to get rid of those blank items first.
The good news is that, with JQuery, this is a very easy fix:
$('#YourListBoxID option').each(function () {
if(!$(this).val())
$(this).remove();
});
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF
Leave a reply
You must be logged in to post a comment.