I am trying to create a JS function that will take a value from a dropdownlist, add it as a query string to a http link and then open that link.
How to go about that?
Let’s say this is the <select>
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
How would I use that in DOM to access the value of the selected item on the DDL?
function openlink(link) {
window.open(link + "SELECTED_ITEM_GOES_HERE");
}
What is the syntax for SELECTED_ITEM_GOES_HERE?
You need this:
Get selected value in dropdown list using JavaScript?
And this:
How to set querystring with Javascript
To produce this: