Skip to content

Instantly share code, notes, and snippets.

View Rahulsekhardas's full-sized avatar

Rahulsekhardas

View GitHub Profile
@jpetto
jpetto / gist:1903811
Created February 24, 2012 21:19
store/retrieve multiple select values to/from localstorage
// watch for changes to motivations select
$('#motivations').change(function() {
var selected = []; // create an array to hold all currently selected motivations
// loop through each available motivation
$('#motivations option').each(function() {
// if it's selected, add it to the array above
if (this.selected) {
selected.push(this.value);
}