I canāt get a button display on my browser. The server is running and everytime i refresh the page, the terminal posts http/1.1 304. I double checked my main.js and index.html and the code is right. But still no display
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Culture</title>
</head>
<body>
<div>
<button id="btnConnect">Connect wallet</button>
<button id="btnUserInfo">Profile</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="https://unpkg.com/moralis/dist/moralis.js"></script>
<script src="main.js"></script>
</body>
</html>``
Moralis.initialize("Le95gObRCYtxHc8EUnBfLByDfBWRFEZkjlNRXa0J");
Moralis.serverURL = 'https://ldkjffesu0ln.usemoralis.com:2053/server'
init = async () => {
window.web3 = await Moralis.Web3.enable();
initUser();
}
initUser = async () => {
if (await Moralis.User.current()){
hideElement(userConnectButton);
showElement(userProfileButton);
}else{
showElement(userConnectButton);
hideElement(userProfileButton);
}
}
login = async () => {
try {
await Moralis.Web3.authenticate();
initUser();
} catch (error) {
alert(error)
}
}
hideElement = (element) => element.style.display = "none";
showElement = (element) => element.style.display = "block";
const userConnectButton = document.getElementById("btnConnect")
userConnectButton.onclick = login;
const userProfileButton = document.getElementById("btnUserInfo")
init();
it doesnāt matter because i donāt see either oneā¦
Maybe you have problem with your local server settings?
Check it there:
Did u run my code or is that your code?
Sweet. Thatās my code! At least i did that part right. Iāve been trouble shooting since last night
How do i fix my server? Let me double checkā¦
Iāve copied and pasted your code.
Are you using a code editor plugin āLive Serverā?
I added the extension but havenāt quite figured it out. Iām new to thisā¦
I seeā¦ Now it says mweb is not a constructor
Which code editor do you use?
Virtual Studio Code vscode
Try this plugin:
https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer#review-details
Thatās the one Iām using
Its my metamask web 3 extension. I only had the metamask ext. Smh. Now it says object objectā¦ How should i set the settings in the metamask web3 ext?
Now it says cannot read property map
Does the metamask have to be preset to a particular testnet?