# Code Explanation from Tutorial

**URL:** <https://forum.kirupa.com/t/code-explanation-from-tutorial/121173>\
**Category:** Uncategorized\
**Created:** [August 31, 2004, 3:25pm UTC](https://forum.kirupa.com/t/code-explanation-from-tutorial/121173 "2004-08-31T15:25:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcoltonbrown](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@dcoltonbrown](https://forum.kirupa.com/u/dcoltonbrown)\
**Post date:** [August 31, 2004, 3:25pm UTC](https://forum.kirupa.com/t/code-explanation-from-tutorial/121173/1 "2004-08-31T15:25:37Z")

</div>

1st of all, thank you to everyone who has helped me in the past. Kirupa is a wonderful resource for people like me who are trying to learn.

I was hoping someone could explain the following code to me.

```auto
function displayDetails(c){
	textbox.text = c.getSelectedItem().label+" :";
	var j = c.getSelectedItem().data;
	textbox.text += "
"+j.getDate()+" "+ month[j.getMonth()]+" "+j.getFullYear();
}

```

My ultimate goal is to take a selected item in one listbox and send it to another text box to be displayed.

So:

```auto
qlist.addItem("a");
qlist.additem("b");
qlist.addItem("c");

//My listbox is named qlist and I want the selected item 
//to appear in a text box named player1.  
//This is where I am lost because the above sample is pulling 
//a date and additional data. Below is my best guess that does not work.  
//Can someone please help

function displayDetails(p1){
	player1.text = p1.getSelectedItem().label+" :";
}

qlist.setChangeHandler("displayDetails");

```
