0

I'm using below JS code to hide "Save and Send Update" button , but it's not working

function hideBtns(){
if(document.getElementsByName("sendEmail")[0]!=null)
    document.getElementsByName("sendEmail")[0].style.display = "none";
if(document.getElementsByName("sendEmail")[1]!=null)
    document.getElementsByName("sendEmail")[1].style.display = "none";
}
if (window.addEventListener) {
    window.addEventListener("load", hideBtns, false);
}
else if (window.attachEvent) {
    window.attachEvent("onload", hideBtns);
}
}

Any help will be highly appreciated.

8
  • what error do you see on console? Mar 30, 2016 at 5:59
  • I'm not getting any error , but it's not hiding the button
    – ds9972
    Mar 30, 2016 at 6:00
  • Do you know how to use console in chrome? try executing document.getElementsByName("sendEmail")[0].style.display = "none"; If it does not found sendEmail[0] it will show error. Try same thing in [1] if its does not find both then that could be reason of your issue. Mar 30, 2016 at 6:05
  • From where this hideBtns fuction is getting called? Mar 30, 2016 at 6:58
  • I am adding to home page component and then adding it to home page layout
    – ds9972
    Mar 30, 2016 at 7:00

1 Answer 1

0

what about giving an Id to those buttons and hide it in style.

#your_id{
    display: none;
}

1
  • That is a std button like new and save...its not an vf page
    – ds9972
    Mar 30, 2016 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .