# Help !!!

**URL:** <https://forum.wixstudio.com/t/help/8589>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [June 19, 2023, 7:36am UTC](https://forum.wixstudio.com/t/help/8589 "2023-06-19T07:36:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smjienn](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/smjienn/32/8205_2.png) [@smjienn](https://forum.wixstudio.com/u/smjienn)\
**Post date:** [June 19, 2023, 7:36am UTC](https://forum.wixstudio.com/t/help/8589/1 "2023-06-19T07:36:38Z")

</div>

When I create a dropdown list at homepage and select one of the choice. How I can pass the value to the text in lightbox.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [June 19, 2023, 10:54am UTC](https://forum.wixstudio.com/t/help/8589/2 "2023-06-19T10:54:23Z")

</div>

1. First declare the ID of your DropdownElement.

2. Everything starts when page is ready…

```javascript
   $w.onReady(()=>{

```

```javascript

```

```javascript
   });

```

```
    3. You need an EVENT-TRIGGER...

```

```javascript
   $w.onReady(()=>{

```

```javascript
      $w("#ddnList").onChange( (event) => {
         let ddnValue = event.target.value; console.log(ddnValue);

      });

```

```javascript
   });

```

```
   4) Once you have declared the value of the Dropdown inside a variable, now you are ready to send it over to your LIGHTBOX.

```

```javascript
$w.onReady(()=>{

```

```javascript
      $w("#ddnList").onChange( (event) => {
         let ddnValue = event.target.value; console.log(ddnValue);
         const lbxResponse = await openLightbox(mylBox, lbxData);
         console.log(lbxResponse);
      });

```

```javascript
   });

```

```
  As you can see there are a few new code-lines, what are they for? And what is still missing?

```

Well…  
a) When working with Lighboxes you will first need to import the API for it first…

```javascript
import { openLightbox } from 'wix-window';

```

b) lbxResponse → This will be the response-data which will be send back to your backe, when you have closed your lighbox.  
c) mylBox —\> This is the NAME/ID of your Lighbox, at this point you also first have to declare it inside a VARIABLE, let’s do it first…

```javascript
let mylBox = "NAME OF YOUR LIGHBOX HERE";

```

d) lbxData → This will be the data, which you want to send over to your lighbox.  
Since you want to send the selected value of your Dropdown, it will be like the  
following…

```javascript
let lbxData = ddnValue

```

So, conclusion…(full code…)

```javascript
$w.onReady(()=>{
    let mylBox = "NAME OF YOUR LIGHBOX HERE";

```

```javascript
      $w("#ddnList").onChange( (event) => {
         let ddnValue = event.target.value; console.log(ddnValue);
         const lbxResponse = await openLightbox(mylBox, ddnValue);
         console.log(lbxResponse);
      });

```

```javascript
   });

```

So, your first part of your mission is complete. At that moment, your chosen LIGHBOX, should open. But now you need to write the SECOND CODE-PART (on LIGHBOX), to recieve the sent data from your page.

CODE-PART-II:

…continue…

```javascript
/ *****************

```

```javascript
  Lightbox Code 

```

```javascript
 ***************** /

```

```javascript
import { lightbox } from 'wix-window';

```

```javascript
$w.onReady(function () {

```

```javascript
  let receivedData = lightbox.getContext();

```

```javascript
 

```

```javascript
});

```
