The example above (selectobx2.value = selectbox.value) will correlate 2 selection elements based on value, from your description, I think that you want to adjust 2 selection elements based on display value or text property.
Unfortunately, there is no shortcut for this, and you need to list the parameters yourself, looking for the parameter whose text property matches the one you are looking for.
var selectbox=document.getElementById("Lstrtemplate");
var TemplateName=selectbox.options[selectbox.selectedIndex].text;
var select2 = document.getElementById("SecondSelect");
for (optionElem in select2.options)
if (optionElem.text == TemplateName)
{
select2.value = optionElem.value;
break;
}
source
share