I have a select box with information about people in it. When you click on their name in the select box, I'm trying to display information (Name, Address, Height, Weight) about them inside of a <div>. Here is what I have so far:
<form>
<SELECT NAME="list1" MULTIPLE SIZE=20 class="set_width" id='developer'>
<option value=43>John Doe </option>
<option value=42>Jane Doe </option>
<option value=38>Bob Smith </option>
</SELECT>
</form>
<div id="output">
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#developer").change(onSelectChange);
});
function onSelectChange(){
var selected = $("#developer option:selected");
var output = "";
if(selected.val() != 0){
output = "You Selected " + selected.text();
}
$("#output").html(output);
}
</script>
Now, what I am thinking is that I need to use selected.val() to pull the value (we'll call it id)of each person and have that id correspond with a row in an array. That row contains all of the information that I need.
Does this make sense? How would I go about doing something like this? Any suggestions would be appreciated.
I just realized that I posted this in the wrong java forum. If someone would move it that would be great.