Hi,
I need to hide the "Add existing" button.
Here's the code i'm using:
Code Snippet
//HIDE ADD EXISTING
_tryhide2 = function(){
try{
with (document.all['new_contact_new_dineintakeawaycommentcardFrame'].contentWindow.document){
if (readyState != 'complete') return
setTimeout(arguments.callee,100);
// Now you are placed in the frame that contains the button you want to hide
if (getElementById('_MBtoplocAssocOneToMany10001newcontactnewdineintakeawaycommentcard')!=null)
{
// The id is the one that you want to hide
with (getElementById('_MBtoplocAssocOneToMany10001newcontactnewdineintakeawaycommentcard')){
style.display='none';
// nextSibling.style.display='none'; //hide the spacer as well
}
}
}
} catch(e) { return setTimeout(arguments.callee,100); }
}
document.getElementById('nav_new_contact_new_dineintakeawaycommentcard').attachEvent('onfocus',_tryhide2);
I tried it on a VM, it worked fine. Now i'm trying it on a real server, i'm getting the following problem.
When i click the first time on the button in the left bar to open the associated view, i can see the "Add existing" button; if i then click on anothe button from the left bar and then reclick on my button(which i need to hide the "Add existing" for) then the "Add existing" button is hidden.
So i have to click the button on the left bar then click another then reclick it in order to see that "Add existing" is hidden.
So how can i make it disappear from the first click?
What could be wrong in the code?
It's urgent!!
Thanks in advance