首页 > 解决方案 > 未捕获的 ReferenceError:f1e90d585f7b48a78107 未在 HTMLHeadingElement.onclick (questions.html:1) 中定义

问题描述

这里提出的大多数问题都包含一个 js 库,但我的没有。我真的不知道为什么它说它没有定义。这是我的代码。我试图触发一个事件,onclick但我不断收到上述错误。这是我使用 onclick 的地方。哦,我的 id 是 UUID

fetch('http://127.0.0.1:5000/api/v1/questions')
  .then((response) => response.json())
  .then((data) => {
    let outputs = '<h2> Top Questions </h2>';
    data.message.forEach(function(questions) {
      outputs += `
                        <div>
                        <h3  onclick="getSingleQuestion((${questions.Question_ID}))"> <a href="#">Title: ${questions.title}</a><h3>
                        <p> Description: ${questions.description}</p>
                        <p> Tags: ${questions.tags}</p>
                        <hr>

                        </div>
                            `;
    });
    document.getElementById('outputs').innerHTML = outputs;
  })

标签: javascriptonclick

解决方案


推荐阅读