In fact you have to re-check the *id* of both the 'select' box and the 'text-box'.It should work if these two are correct.
Thanks & Regards, Dhruva Sagar. Samuel Goldwyn<http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html> - "I'm willing to admit that I may not always be right, but I am never wrong." On Fri, Aug 21, 2009 at 2:30 PM, Tan <itqn2...@gmail.com> wrote: > > yes, i have to change code to: > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ > TR/html4/strict.dtd"> > <html lang="en"> > <head> > <title>test</title> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> > <script type="text/javascript" src="http://jqueryjs.googlecode.com/ > files/jquery-1.3.2.min.js"></script> > <script type="text/javascript"> > $(document).ready(function(){ > $('#edit-default-source').change(function() { > $('#edit-field-soure-0-value').text($(this).val()); > }); > }); > > </script> > <body> > <select name="default_soure" class="form-select" id="edit-default- > soure" > > <option value="0">hongkiat.com</option> > <option value="1">smashingmagazine.com</option> > </select> > <input type="text" name="field_sourc[0][value]" id="edit-field-sourc-0- > value" ></input> > <div> > </div> > > </body> > </html> > > > But it's not works. i want to take "hongkiat.com",... in in textbox > when select listbox. > Please help me! > > On Aug 21, 3:29 pm, Dhruva Sagar <dhruva.sa...@gmail.com> wrote: > > For the listbox you should simply use the function *change *i'll give an > > example : > > > > $('#edit-default-source').change(function() { > > $('#edit-field-soure-0-value').text($(this).val()); > > > > }); > > > > This should do what you want (if I correctly understood it), once you > select > > an option in the select drop down box, the text box will get populated > with > > the selected value. > > > > Thanks & Regards, > > Dhruva Sagar. > > > > Marie von Ebner-Eschenbach< > http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac....> > > - "Even a stopped clock is right twice a day." > > > > > > > > On Fri, Aug 21, 2009 at 10:37 AM, Tan <itqn2...@gmail.com> wrote: > > > > > i have to create a listbox and a textbox. > > > I want to select value form listbox then this value shows in textbox > > > <code> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ > > > TR/html4/strict.dtd"> > > > <html lang="en"> > > > <head> > > > <title>test</title> > > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> > > > <script type="text/javascript" src="http://jqueryjs.googlecode.com/ > > > files/jquery-1.3.2.min.js"></script> > > > <script type="text/javascript"> > > > $(document).ready(function(){ > > > $('#edit-default-soure').change(function(){ > > > var str = ""; > > > $("#edit-default-soure option:selected").each(function () { > > > str += $(this).text() + " "; > > > }); > > > $("#edit-field-sourc-0-value").text(str); > > > }) > > > .change(); > > > > > }); > > > > > </script> > > > <body> > > > <select name="default_soure" class="form-select" id="edit-default- > > > soure" > > > > <option value="0">hongkiat.com</option> > > > <option value="1">smashingmagazine.com</option> > > > </select> > > > <input type="text" name="field_sourc[0][value]" id="edit-field-sourc-0- > > > value" ></input> > > > <div> > > > </div> > > > > > </body> > > > </html> > > > </code> > > > But it's not work. > > > Please help!- Hide quoted text - > > > > - Show quoted text -