I cannot for the life of me figure out what I am doing wrong. I am following the metamask docs and everything: https://docs.metamask.io/guide/create-dapp.html#basic-action-part-1
.html button:
<!DOCTYPE hmtl>
<html lang="en">
<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>Document</title>
<link rel="stylesheet" >
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn.jsdlivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="./javafilename.js"></script>
</head>
<body>
<button class="btn btn-primary btn-lg btn-block mb-3" id="connectButton" value="Connect" enabled></button>
<body>
</html>
metamask java:
const initialize = () => {
//Basic Actions Section
const onboardButton = document.getElementById('connectButton');
};
I don't see an error in your code, it just that you need to keep following the instructions, by giving the current code i can see its working, take a look at this Codesandbox
https://codesandbox.io/s/kind-frost-f4zgd7?file=/index.html
If you notice, when you click the button, it tell us Metamask is installed
Few points.
window.addEventListener('DOMContentLoaded', initialize); and you want to do it on a button, see onclick="initialize()" Also please make sure for other questions to provide an error or something so the community can help you better