| | |
Select Box Updates DIV on the page
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2009
Posts: 2
Reputation:
Solved Threads: 0
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:
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.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<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>
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<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.
Last edited by sops21; Oct 15th, 2009 at 6:37 pm. Reason: Posted in wrong forum.
0
#2 Oct 15th, 2009
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.
Request to move post to correct section already sent.
Last edited by peter_budo; Oct 15th, 2009 at 6:39 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- passing values of Select box from JSP to Action class thru form Bean (JSP)
- hiding the select box by changing the select box color (PHP)
- Curl function to select options from a select box and auto submit (PHP)
- [HELP] Regarding on select Box (PHP)
- select box issue (PHP)
- Populating Select Box w/ Passed In Value? (JavaScript / DHTML / AJAX)
- Select Box populates text field (JavaScript / DHTML / AJAX)
- bringing data from mysql using select box (PHP)
- populate a select box using PHP (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Form without action "imitate" of other Form (which do have action) ???
- Next Thread: delete history from browser
| Thread Tools | Search this Thread |
.net acid2 ajax android api apple applet applicaions array asp automation balls beginner binary browser c# c++ c/c++ chat check class clear code component css design developer development developmenthelp digit dynamically eclipse error event file firefox forms fractal froglogic game google gui guitesting html ibm image integer j2seprojects java javafx javaprojects javascript jetbrains jsp julia jvm linux listbox mergers method microsoft msdn mysql netbeans newbie news noob office php pong print problem programming python radio reference ruby search security sell set size smart software sort sql state string subclass sun support swing thread threads tree ui virtualbox vista web windows







