[英]why jquery code not running in jsfiddle
i am trying it on jsfiddle...............i dont know why its not running...........someone help 我在jsfiddle上尝试...............我不知道为什么它没有运行...........有人帮忙
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();
working demo http://jsfiddle.net/zJ3yk/ 工作演示 http://jsfiddle.net/zJ3yk/
because you got extra }
因为你有额外的
}
rest should help the needs :)
休息应该有帮助
:)
code 码
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();
Check the following jsfiddle. 检查以下jsfiddle。 you can find working js.
你可以找到工作的js。
http://jsfiddle.net/shivkant/HQyZe/8/ http://jsfiddle.net/shivkant/HQyZe/8/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.