【发布时间】:2015-03-25 12:57:21
【问题描述】:
我试图在点击时调用我的 javascript 函数:
<div id='alert'><button onclick='alertClose()' class='alert'>Close</button></div>
函数如下:
function alertClose(){
$("#alert").animate({
left: "107%"
});
}
编辑:控制台一直说没有名为 alertClose 的函数
【问题讨论】:
-
您的问题是什么?你看到了什么错误?
-
它做什么而不是工作?:) 任何错误消息?函数是被调用了,但没有做你想做的事,还是根本没有被调用?
-
这里是网站:chat-trial-silverneon123-2.c9.io 警报在右下角,按钮是我遇到的问题
-
您需要改进问题,而不是添加其他人以后无法重现问题的链接
-
我的猜测是这个错误:Uncaught TypeError: Cannot read property 'innerHTML' of undefined 导致你的 js 失败。只是一个想法。另外,如果您使用的是 jquery,为什么不这样做: $("#alert button").click(alertClose);而不是在 html 中声明它。
标签: javascript jquery