I have an eventListener that won't allow me to pass parameters through it. I want to pass parameters through the addTextBox function. I tried passing it using the bind function and that does not working either. The code is below:
var jobSelect = document.getElementById("ctl01_TemplateBody_WebPartManager1_gwpciMyAccount_ciMyAccount_Affiliate_panelEditor_Demographics___JOB_TITLE");
var jobBox = document.getElementById("ctl01_TemplateBody_WebPartManager1_gwpciMyAccount_ciMyAccount_Affiliate_panelEditor_Demographics___OTHER_JOB_TITLE");
var jobLabel = jobBox.parentElement.previousSibling;
jobSelect.addEventListener("change", addTextBox.bind(jobSelect,jobBox,jobLabel), false);
function hideTextBox(){
if(jobSelect)
{
if(jobSelect.value != "ZZ"){
jobBox.style.visibility = "hidden";
jobLabel.style.visibility = "hidden";
jobBox.style.position = "absolute";
jobLabel.style.position = "absolute";
}
}
}
function addTextBox(x,y,z){
if(x){
if(this.value == "ZZ"){
y.style.visibility = "visible";
z.style.visibility = "visible";
y.style.position = "";
z.style.position = "";
}
else{
hideTextBox();
}
}
}
hideTextBox();