Hi guys,
I just want to use a custom javascript file in my theme, but it doesn't work. Could somebody find my error?
I also tried to add my code directly into a .phtml file, but even that does not work.
So I created ../app/design/frontend/Myvendor/mytheme/requirejs-config.js
var config = {
map: {
'*': {
mainjs: "js/main"
}
}
Then I created ../app/design/frontend/Myvendor/mytheme/web/js/main.js
define([
'jquery',
'uiComponent',
],
function ($, Component) {
'use strict';
$(document).ready(function(){
var footerMenu = document.getElementsByName('footerMenu');
var radio;
var x = 0;
for(x = 0; x < footerMenu.length; x++){
footerMenu[x].onclick = function() {
if(radio == this){
this.checked = false;
radio = null;
}else{
radio = this;
}
};
}
});
return Component.extend({});
});