We have this function on a js file to pull a menu tree when users click on the parent item:
function menusel(unid)
{
//if its in the array, deactivate it and take it out
var index = inarray(unid,selectedarray);
//first arrange the array
if(index)
{
selectedarray[index] = 0;
}
else
{
//we have restrictions
if(treeRestrictMode==1)
{
//now check its not in the array of items not allowed to b picked
if(inarray(unid,nonSelArr))
{
alert('This Item is Unselectable');
return;
}
}
//if we are in unique tree mode, can only select one
if(treeSingleMode==1)
{
//check for a non zero value, and deselect it [recursively]#
for(var x=0;x<selectedarray.length;x++)
{
if(selectedarray[x]!=0)
{
//alert(unid+' '+selectedarray[x]);
menusel(selectedarray[x]);
}
}
}
selectedarray.push(unid);
}
sel_unselect(unid,index);
//if we have an override function, it means we will assume that the parent page
//as an input type function called treeSelFunc which takes the id and takes care of the rest
if(overrideFunction!='')
{
parent.parent.treeSelFunc(unid,selName);
return;
}
if(treeSingleMode!=1)
{
var selObj = emptySel(0);//set txt will fill it for us
}
else
{
var selObj = parent.parent.MM_findObj(selName);
//see if we have options..will need to empty them
if(selObj.size>1)
{
emptySel(1);
}
else
{
selObj.value=0;
}
}
setTxt(selObj);
selObj.fireEvent('onchange');
}
which we call like this on a page as this:
<a id="troot[VMENU]_040" onclick="menusel(40);" class="sel">All</a>
And we are getting this: Uncaught TypeError: selObj.fireEvent is not a function
It used to work on an older browser version (I think with explorer 8) but now is not working any more using Chrome. Any ideas why?
The fireEvent method is a proprietary Microsoft Internet Explorer alternative to the standard EventTarget.dispatchEvent() method.
Use the dispatchEvent method instead.
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent