How do I save and restore select options?
http://forum.jquery.com/topic/how-do-i-save-and-restore-select-options#14737000006772157
by Akram kamal
HTML
<select name="targetReport" id="targetReport">
<option class="Mixed" value='AllBreedsHorseofTheYear.cfm'>Any Breed - Horse of the Year</option>
<option class="Mixed" value='FairMeetChampion.cfm'>Any Breed - Fair Meet Champion</option>
<option class="Mixed" value='MixedMeetChampion.cfm'>Any Breed - Mixed Meet Champion</option>
<option class="TB" value='TBHorseofTheYear.cfm'>TB - Horse of the Year</option>
<option class="TB" value='TB2yFilly.cfm'>TB - Two Year Old Filly</option>
<option class="TB" value='TB2yColt.cfm'>TB - Two Year Old Colt/Gelding</option>
<option class="TB" value='TB3yFilly.cfm'>TB - Three Year Old Filly</option>
<option class="TB" value='TB3yColt.cfm'>TB - Three Year Old Colt/Gelding</option>
<option class="TB" value='TBChampionMare.cfm'>TB - Champion Mare</option>
<option class="TB" value='TBChampionSire.cfm'>TB - Champion Stallion/Gelding</option>
<option class="TB" value='TBLeadingRaceStockOwner.cfm'>TB - Leading Owner</option>
<option class="TB" value='TBLeadingDam.cfm'>TB - Leading Dam of Racing Stock</option>
<option class="TB" value='TBLeadingBreeder.cfm'>TB - Leading Breeder of Racing Stock</option>
<option class="TB" value='TBLeadingSire.cfm'>TB - Leading Sire of Racing Stock</option>
<option class="TB" value='TBLeadingSireOwner.cfm'>TB - Leading Sire Owner of Racing Stock</option>
<option class="TB" value='TBLeadingFemaleSprinter.cfm'>TB - Leading Female Sprinter</option>
<option class="TB" value='TBLeadingMaleSprinter.cfm'>TB - Leading Male Sprinter</option>
<option class="TB" value='TBLeadingFemaleTurf.cfm'>TB - Leading Female Turf Runner</option>
<option class="TB" value='TBLeadingMaleTurf.cfm'>TB - Leading Male Turf Runner</option>
<option class="TB" value='TBLeadingClaimer.cfm'>TB - Leading Claimer of the Year</option>
<option class="QH" value='QHHorseofTheYear.cfm'>QH - Horse of the Year</option>
<option class="QH" value='QH2yFilly.cfm'>QH -...
JavaScript
var options
$(function() {
options = $("#targetReport option").remove()
filterOptions(localStorage.type||"All")
})
function filterOptions(type) {
localStorage.type = type
if (type === "All") {
$("#targetReport").html(options)
} else {
$("#targetReport").empty()
options.filter("." + type).appendTo($("#targetReport"))
}
}