I have created a custom detail page button(onclick calling Javascript) that is showing in salesforce classic experience but not in lightning experience. I have added the button to the page layout. I don't understand why this is happening. Can some one explain it to me ?
There are screenshots of the detail pages :
Lightning:
Classic :
Best Answer
I think you can not call JS from a button in Lightning.
When transitioning from classic to lightning one of the things you should take care is exactly that.
SF considers calling JS from a button to be security risk and hard enforce good coding practices there.
You should design the same functionality using hopefully Process or Flow. If they are not sufficient try with a custom apex action in Flow to do what you need there.
Or maybe custom Lightning component to make easier transition if you use Js a lot for your functionality.