Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
Can you make JSDoc work in HTML when embeding JavaScript code?

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?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda