-5

Here is my code in jsFiddle:

http://jsfiddle.net/AXXGZ/4/

html

<html>
    <body>
        <a href="abc.com", id="a">aa</a>
    </body>
</html>

javascript

$('#a').click(function(){
    alert ('aa');

})

run

onLoad with MooTools 1.3.2

Why is my click callback function not called?

4

5 回答 5

6

Because, you're using mootools on the fiddle... always happens to me too :p

http://jsfiddle.net/mazlix/AXXGZ/6/

于 2011-07-20T19:27:06.787 回答
2

You aren't using jQuery. Select it from the drop-down at the left and your code works.

However your HTML also has a syntax error; you should remove the comma from this tag:

<a href="abc.com", id="a">aa</a>
于 2011-07-20T19:28:29.357 回答
1

当 jsfiddle 加载时,它会将 Mootools 设置为默认的 JavaScript 框架。你的语法看起来像 jQuery... 所以你应该选择它。

jsfiddle jQuery

我希望这有帮助。
赫里斯托

于 2011-07-20T19:50:08.873 回答
1

You're not using jQuery in your fiddle

http://jsfiddle.net/AXXGZ/14/

于 2011-07-20T19:28:19.513 回答
1

您正在使用 mootools,请查看 http://jsfiddle.net/AKbnp/4/

编辑:该死的......在我之前几乎有3个答案......

于 2011-07-20T19:29:23.493 回答