Where should I put this menu code for header?
I put code in a page and it worked but when I moved the menu to the header getting an error.
https://www.wix.com/velo/example/mega-menu
Errors:
error TypeError: repeaterSelector.onItemReady is not a function
Error: $itemBtn.onClick is not a function
code is in masterPage.js
Thansk in advance
First at all you should maybe show the code, which you have moved.
Second, elements and code, should be moved to MASTER-PAGE.
That means your REPEATER should be placed inside the MASTERPAGE.
Your code also should be placed on MASTERPAGE.
You should have something like… (on MASTERPAGE)…
$w.onReady(()=>{
$w('#repeater1').onItemReady(($item, itemData, index)=>{
console.log("Item-Data: ", itemData);
console.log("Index: ", index);
$item('#IDofONE ofYOURelementsINSIDErepeaterHERE').text = "";
$item('#IDofONE ofYOURelementsINSIDErepeaterHERE').value = "";
$item('#IDofONE ofYOURelementsINSIDErepeaterHERE').WHATEVER= "";
});
});