I have an external js file, wanting to put a link into a span on the html file.
function QuizDetails() {
document.getElementById("quiz-link").innerHTML = <a href="quiz.html">Take quiz again</a>;
}
The html code
<p><span id="quiz-link"></span></p>
For some reason the js dosent run, the code below works fine but obvious I want to pass an anchor. Any ideas?
function QuizDetails() {
document.getElementById("quiz-link").innerHTML = "take quiz again";
}
您缺少引号...
document.getElementById("quiz-link").innerHTML = '<a href="quiz.html">Take quiz again</a>';
<p><span id="quiz-link"></span></p>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.