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.html>
- "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!
>

Reply via email to