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.

Recommended Answers

Java and JavaScript are not the same thing. Java is product of Sun Microsystems where JavaScript is product of Netscape. Java is an programming language, JavaScript is obviously scripting language.
Request to move post to correct section already sent.

Jump to Post

All 2 Replies

Java and JavaScript are not the same thing. Java is product of Sun Microsystems where JavaScript is product of Netscape. Java is an programming language, JavaScript is obviously scripting language.
Request to move post to correct section already sent.

Thanks for putting in the request. I noticed it was in the wrong forum as soon as I posted it. Sorry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.