I want to include custom JavaScript to create new product form
.
I already try with below way
- Using XML way.
app/code/Namespace/Modulename/view/adminhtml/layout/index_index_add.xml
<head>
<link src="Namespace_modulename::js/website_validation.js"/>
</head>
- Using
require-config.js
way
app/code/Namespace/Modulename/view/adminhtml/require-config.js
var config = {
'paths': {
websitevalidation: 'Namespace_Modulename/js/website_validation'
}
};
app/code/Namespace/Modulename/view/adminhtml/web/js/website_validation.js
require(['jquery','websitevalidation'],function($){
$(window).load(function() {
alert('innn');
});
});
What i missing or wrong in above code.
Any help would be appreciated. Thanks.