DEV Community 👩‍💻👨‍💻

Paboda Hettiarachchi
Paboda Hettiarachchi

Posted on

Adding a custom js to backend - Magento 2

To add a JS througout backend in Magento, I followed the following method.

1.Add the head tag in Paboda/Demo/view/adminhtml/layout/default.xml

<?xml version="1.0"?>

<page xmlns:xsi=""
        <link src="Paboda_Demo::js/lib/custom.js"/>
Enter fullscreen mode Exit fullscreen mode

2.Add the custom.js file to the following path Paboda/Demo/view/adminhtml/web/js/lib/custom.js

Top comments (0)

⬇️ The only reason people scroll to the bottom...


is because they want to read more. Sign up for an account to bookmark, comment, and react to articles that interest you.