这里提出的大多数问题都包含一个 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;
})