I am having trouble implementing the autocomplete feature in my JavaScript code editor using Codemirror. Can someone please help me figure out what I'm doing wrong?
Here is the snippet of code :
var editor = CodeMirror.fromTextArea(myTextarea, {
lineNumbers: true,
extraKeys: {
"Tab": "autocomplete"
},
hint: CodeMirror.hint.javascript
});
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://codemirror.net/lib/codemirror.js"></script>
<script src="https://codemirror.net/mode/javascript/javascript.js"></script>
<script src="https://codemirror.net/addon/hint/show-hint.js"></script>
<script src="https://codemirror.net/addon/hint/anyword-hint.js"></script>
<link rel="stylesheet" href="https://codemirror.net/lib/codemirror.css">
<link rel="stylesheet" href="https://codemirror.net/addon/hint/show-hint.css">
<title>Code</title>
</head>
<body>
<textarea name="myTextarea" id="myTextarea" cols="30" rows="10"></textarea>
</script>