June 12th, 2009, 03:17 PM
I have just started learning JS and here's where am stuck to know how to get a text from a text box and post it to a div .
Here is the problem statement .I have a text box for names and a list for categories.What I want is when the user types a name and selects the category and clicks submit the name should appear under the list div.
Example: Name : Bob
Result: the name appears under Student div
Simple? Would very much appreciate the code to do that, and please assume I know zero about JS - so I need it all
Reply With Quote
June 13th, 2009, 03:51 AM
Here it is:
document.getElementById("result_name").innerHTML = document.getElementById("input_name").value;
Name: <input type=text id="input_name" size=20>
List: <select name="lstbox1" size=1 onchange="test_lstbox_item(this)" style=width:200px>
<option value="C" selected>Cat</option>
<p>Result: <div id="result_name"></div>
June 23rd, 2010, 04:58 AM
thank you for this nice post
it's relay helpful to me.
June 23rd, 2010, 09:23 AM
Welcome to the forums zaggaustralia. Please remember to keep your posts relevant. This thread is a year old.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!