New to JSON so I’ll do my best here. I have a JSON object called HUDS. Below are 2 sample nodes (by the way, can I call these nodes in JSON like in XML?).
var HUDS = [
{
"DISTRICT": "100",
"BIOS": "BROWN",
"AREA_KM": "3663.158164",
"AREA_MI": "1414.347616",
"NAME": "100",
"REG": "1",
"ACRES": "905182",
"EMU_Name": "Purcell",
"Shape_Leng": "299746.4938",
"Shape_Area": "3663158164",
},
{
"DISTRICT": "101",
"BIOS": "THIER",
"AREA_KM": "1507.774765",
"AREA_MI": "582.152762",
"NAME": "101",
"REG": "1",
"ACRES": "372578",
"EMU_Name": "Salish",
"Shape_Leng": "229150.0655",
"Shape_Area": "1507774766",
}
]
I have a drop down form that will be used to specify a value specific to the “BIOS” field in my JSON. For example the user could select BROWN from the dropdown menu.
I’d then like to create a var that can be used to fill in a div. For example when the user selects BROWN I’d like my div to fill with the value from “EMU_Name”
I know this is wrong but maybe it conveys what I am going for
function dropDownAction(){
var tempBios=document.BIOSForm.BIOS.value;
var tempEmuValue=HUDS.BIOS==tempBios.EMU_Name;
document.getElementById("mydiv").innerHTML=tempEmuValue;
}
Try: