Assigning dropdown text to a javascript variable

Problem: I have a dropdown list and when a user selects one of the items I want assign the name of item as text to a variable in javascript.

ActivePresenter version: 9.3.0

OS: Win 11

Notes:

Hi,

I’ve prepared a sample project that demonstrates exactly what you’re trying to achieve. You can find it attached. Please check the implementation inside the project, and you’ll see how to assign the selected dropdown item text to a variable using JavaScript. Let me know if you have any questions after reviewing it.

Demo_2.approj (220 KB)

2 Likes

Hi,

thank you for your response and your demo works however it isn’t quite what I require.

I need to assign the text the user has selected to a javascript variable so that I can access the text in my javascript code. unfortunately I do not know how to access Activepresenter user definted or system variables.

I would also be able to do what I require by knowing which option the user has selected if this is easier.

Thanks.

1 Like

Hi @scottjones05 -

The demo provided by @BurhanBey does assign the text of the dropdown selection to a user defined variable. SelectedItem

In order to work with that variable such as change it or to perform a conditional check it would look as follows.

Change Variable Value
prez.variable("SelectedItem","red");

Perform Conditional Check

if (prez.variable("SelectedItem") == "blue") {
    ..stuff to happen here..
}

Hopefully this helps you a little further.

2 Likes

Thanks for the info. All sorted now.