Custom code Data Element returning empty value
Hi, I tried using the below custom code to capture dropdown selection values as data element. It works in console but when i input the code as a data element and check the _satellite.getVar() for this data element, it just returns an empty value "".
My Javascript is basic and i am fairly new to Adobe Launch so step by step instructions with visuals would be great.
Thank you
var selectElm = document.querySelector("#order_retailer_name")
selectElm.addEventListener("click",function(){
var elm = this;
var selectedElm = elm.options[elm.selectedIndex].textContent;
return selectElm;
});