Hi,
First post so please go easy on me!
I am trying to capture a value to use as a label in tag manager.
I’ve set a hidden field, however, using the below Javascript (Which also serves getting the Id on forms that use a drop down) I am unable to capture this.
Does anyone have any advice on the best way to do this in GTM?
function() {
var form = {{Form Element}};
var selectList = form.querySelector(’#location’);
var hiddenField = form.querySelector(’#hiddenFieldID’);
if (selectList !== null) {
return selectList.optionssselectList.selectedIndex].value;
} else if (hiddenField !== null) {
return hiddenField.value;
}
return;
}
Any help is much appreciated. Sorry, I am not too familiar with Unbounce so I expect I am missing something here.
Thanks