I want to ignore/remove all options from a select box that either have a blank value or don't have the value="" attribute at all, e.g.
<option>Any Option</option>
<option value="">Any Option</option>
Here is my jQuery:
$(function() {
// Create the dropdown base
$("<select />").appendTo("#pagination_container");
// Create default option "Go to..."
$("<option />", {
"selected": "selected",
"value" : "",
"text" : "Select Page..."
}).appendTo("#pagination_container select");
// Populate dropdown with menu items
$("#pagination_container a").each(function() {
var el = $(this);
$("<option />", {
"value" : el.attr("href"),
"text" : el.text()
}).appendTo("#pagination_container select");
});
$("#pagination_container select").change(function() {
window.location = $(this).find("option:selected").val();
});
});