Skip to content
Advertisement

Javascript – Append a parameter of an option to URL retrieved by a dropdown menu

I have a drop down menu. I use it to select a particular Tea.

JavaScript

Then I want to use javascript to retrieve entry_id of the selected Tea and append the it to end of the URL, e.g. /myshop/tea/865 <– 865 is the entry id for Black Tea

My Javascript code:

JavaScript

But every time it append “Black Tea” or “Green Tea” names, e.g, /myshop/tea/Black Tea or /myshop/tea/Green Tea. Is there a way to append entry_id at the end of the URL, e.g. /myshop/tea/865 or /myshop/tea/123

Advertisement

Answer

JavaScript

makes more sens. use the form widgets as they are supposed to be used.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement