-
Hi, frens! Here's my code: <!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>FundMe Dapp</title>
</head>
<body>
Fund Me!
<button id=""connectButton" onClick="connect()">Connect Wallet</button>
<script>
async function connect() {
if(typeof window.ethereum !== "undefined") {
await window.ethereum.request({ method: 'eth_requestAccounts' })
document.getElementById("connectButton").innerHTML = "Connected!"
} else {
document.getElementById("connectButton").innerHTML = "Please install Metamask!"
}
}
</script>
</body>
</html> When I click on the "Connect Wallet" button, I'm having this error in the console: So, there seems to be an error in this line of code: What am I doing wrong? Please let me know. Thanks! 🙏🏻 |
Beta Was this translation helpful? Give feedback.
Answered by
krakxn
Sep 23, 2022
Replies: 1 comment 2 replies
-
The mistake lies here, <button id=""connectButton" onClick="connect()">Connect Wallet</button> it should be this instead: - <button id=""connectButton" onClick="connect()">Connect Wallet</button>
+ <button id=""connectButton" onclick="connect()">Connect Wallet</button> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The mistake lies here,
it should be this instead: