[英]jsFiddle - what am I missing?
You need to select the "no wrap (head)" option in the sidebar. 您需要在侧栏中选择“不包裹(头部)”选项。 Otherwise, your f()
function gets wrapped up in some $(function() { /*...*/ });
否则,您的f()
函数将包裹在某些$(function() { /*...*/ });
stuff and is not visible to be set in an onclick
attribute: 东西,在onclick
属性中不可见:
http://jsfiddle.net/ambiguous/a6rQX/ http://jsfiddle.net/ambiguous/a6rQX/
Under Framework select "no wrap (head) 在框架下,选择“不换行(头)
Click the Run button. 单击运行按钮。
It should now work. 现在应该可以了。
It is because the function with name f()
local to the onReady function, so it is not available in the global context. 这是因为名称为f()
的函数位于onReady函数的本地,因此在全局上下文中不可用。
onReady(){
function f(){
xyz
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.