View Full Version : Copy last drop down item to text field

06-06-2017, 12:30 AM
Hi all

I have a set of drop down fields where the child item is dependant on the parent, so for example


I also have a text field named Chosen Item

What I want to do is when the last item is selected in the drop down box that the value is then copied to the text field. Obviously if the drop down item is changed now or later then that text field changes as well to the chosen final child drop down selected item

I'm guessing some onevent javascript function is the best option but I really am struggling with where to start, all help appreciated, thanks

If javascript is not the correct solution please help.


Here is something I have found on the net but when I try this it does not work for me, what is wrong here and how could I adapt it for the above?

Copied from http://jsfiddle.net/f23uP/

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="//code.jquery.com/jquery-compat-git.js"></script>

<title>Test copy select</title>
<script type='text/javascript'>


<option value="10">Apple</option>
<option value="20">Orange</option>

<input type="name" />
<input type="price" />


06-11-2017, 02:21 AM

Missed adding


So, javascript is

$(document).ready(function() {