I have a few JSON objects, which I'm fetching data from, but I'd really like to be able to get some specific data, depending on my selection in a selection container, but I'm not sure how tell my function which selection I've chosen. Here's what I've tried so far:
var parsedData = JSON.parse(someData);
$(parsedData).each(function() {
var m = document.getElementById("measurements"); //My selection container
var selectedValue = m.options[m.selectedIndex].text; //What's currently selected
var data = this.selectedValue; //This doesn't work
var data = this.Id //This works
console.log(newData);
});
Any hint appreciated.