-3
你可以看看这个演示,让我知道为什么我在DoSomething
上得到未定义的错误?关于在jQuery中运行函数的问题setInterval
function DoSomething() {
console.log("This is Map");
}
$(document).ready(function() {
setInterval('DoSomething()', 1000);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
我收到此错误
Uncaught ReferenceError: DoSomething is not defined
发布的代码和stack-snippet工作得很好吗? – adeneo
这工作正常,即使我在当前页面的控制台中运行它。 –
它在我的Chrome控制台上运行正常。 –