I have this javascript/jquery function in which I store each elements inside a div to an array. The problem is that it doesn't save the results outside of the anonymous function. How do you setup a global variable?
This is my Javascript/jquery
function store_options(){
var stored_options = new Array;
$('[id^="tagboxfv-"]').each(function(){
var last_index = slice_last_index(this);
$('[id="form-'+last_index+'"] > select[id="v-'+last_index+'"] > option').each(function(){
stored_options[last_index] = [];
stored_options[last_index][$(this).val()]=$(this);
});
});
}