JQuery里面的函数调用另一个函数= undefined? [英] JQuery inside function call another function = undefined?
问题描述
我想在body之前调用另一个函数,但怎么做?
系统显示错误 我只能在body之后添加代码。 该功能超出范围。您需要定义jQuery回调之外的函数。 I want to call another function before body, but how? The system shows me the error I only can add code after body.
That function is out of scope. You need to define the function outside the jQuery callback.
这篇关于JQuery里面的函数调用另一个函数= undefined?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!未定义的函数myx $ c $
< ; script type =text / javascript>
jQuery(function($){
function myx(){
alert(omg);
};
});
< / script>
< / head>
< body>
< script>
jQuery(document).ready(function($){
$(mytest)。click(function(){
myx();
});
});
< / script>
< a href =#id =mytest>检查< / a>
< script type =text / javascript>
函数myx(){
alert(omg);
};
< / script>
< / head>
< body>
< script>
jQuery(document).ready(function(){
$(#mytest)。click(function(){
myx();
});
});
< / script>
< a href =#id =mytest>检查< / a>
undefined function myx
<script type="text/javascript">
jQuery(function($){
function myx() {
alert("omg");
};
});
</script>
</head>
<body>
<script>
jQuery(document).ready(function($){
$("mytest").click(function(){
myx();
});
});
</script>
<a href="#" id="mytest">Check</a>
<script type="text/javascript">
function myx() {
alert("omg");
};
</script>
</head>
<body>
<script>
jQuery(document).ready(function(){
$("#mytest").click(function(){
myx();
});
});
</script>
<a href="#" id="mytest">Check</a>