Some backstory: I am working on a .html file where I solve some JavaScript exercises. I write the exercise description as html where I also have a table with example inputs and their corresponding outputs. Then I have created a form which takes an output and by clicking a button the output appears. Inside the form tags I embed the script where I have several functions.
I have found about JSDoc and manage to display function documentation when using it in the .js file but when I use the function in the .html file nothing happens. I am using VSCode and when starting to write the function name it doesn't even pop in the auto-suggestion.
Here is my .html code:
<form>
<label>Input: </label>
<input type = text id="input3">
<label> Output:</label>
<input type = text id="output3">
<br><br>
<button type="button" onclick=addRem()>Get output</button>
<script src="utils_for_jsExcercises.js"></script>
<script>
function addRem() {
const input = parseArray("input3");
const init = 1;
let output = [];
let current = init;
for (let i=0; i<input.length; i++) {
switch(input[i]) {
case "add": {
output.push(current);
current += 1;
break;
}
case "remove": {
output.pop();
current +=1;
break;
}
}
}
if (output.length === 0) {
console.log("Empty");
}
else console.log(output);
}
</script>
</form>
And my .js file:
/**
* Does stuff
* @param {sting} outputString
* @param {string} outputID
*/
function printOutput(outputString,outputID) {
let output=document.getElementById(outputID);
output.value = outputString;
}
Is it possible to make JSDoc work in the .html file or at least the auto-suggestion for the function name?