Jump to content

How to auto-populate text box with selection made from a drop-down list


JohnCP

Recommended Posts

Hi all, I think my topic title describes my question. I can't seem to figure out how to auto-populate a text box that is right below a drop-down field. When the user selects an item from the drop-down, the selected item should auto populate the text box.Any help is greatly appreicated.Thanks,JP

Link to comment
Share on other sites

HMTL

...<select id="ddl" onchange="autoFill(this)">...options...</select><br/><input type="text" id="txt" value=""/>

js

function autoFill(ddl){  var txt = document.getElementById("txt");  txt.value = ddl.options[ddl.selectedIndex].value;}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...