help in code???

Discussion in 'JavaScript' started by mahiraj, Oct 26, 2007.

  1. #1
    Hi All,

    i have a combo-box which contains values, I want when i click on the particular value it's value also display on a text box.
    the value of the combo are comming from the database.

    please help to do it.

    Thanks.
    Edit/Delete Message
     
    mahiraj, Oct 26, 2007 IP
  2. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #2
    When you say values I assume you do mean value attributes, i.e. <option value='x'>
    Try this. Both elements must be in the same form.

    <form>
    <select onchange="selectedValue.value=this.value">
    .
    .
    </select>
    <input type='text' name='selectedValue'>
    </form>
    
    Code (markup):
     
    Logic Ali, Oct 26, 2007 IP
  3. grikis

    grikis Banned

    Messages:
    333
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    onclick="document.getElementById('textboxid').value=this.value;"
     
    grikis, Oct 26, 2007 IP