Javascript 为什么jquery代码没有在JSFIDLE中运行
我正在JSFIDLE上尝试…………我不知道为什么它不运行…………有人帮忙吗Javascript 为什么jquery代码没有在JSFIDLE中运行,javascript,jquery,Javascript,Jquery,我正在JSFIDLE上尝试…………我不知道为什么它不运行…………有人帮忙吗 html section <html> <body> <div>The Answer is: </div> <div class='answer'></div> </body>`enter code here` </html> js section function writ
html section
<html>
<body>
<div>The Answer is: </div>
<div class='answer'></div>
</body>`enter code here`
</html>
js section
function writeAnswer(answer) { // helper function for output
$('div.answer').append($('<div>').text(answer));
}
function writedemo() {
var answer="hello";
writeAnswer(answer);
}
}
writedemo();
html部分
答案是:
`在这里输入代码`
js部分
函数writeAnswer(answer){//输出的辅助函数
$('div.answer')。追加($('').text(answer));
}
函数writedemo(){
var answer=“你好”;
书面答复(答复);
}
}
writedemo();
工作演示
因为你有额外的}
rest应该有助于满足需求:)
代码
function writeAnswer(answer) { // helper function for output
$('div.answer').append($('<div>').text(answer));
}
function writedemo() {
var answer="hello";
writeAnswer(answer);
}
//} <===== this is the culprit and rest demo gives you idea.
writedemo();
函数writeAnswer(answer){//helper函数用于输出
$('div.answer')。追加($('').text(answer));
}
函数writedemo(){
var answer=“你好”;
书面答复(答复);
}
//}检查以下JSFIDLE。你可以找到工作的js
如何链接到小提琴,这样我们就可以确保您在库中正确链接,正确使用onLoad()
等