<html>
<body>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('img').click(function(){
var getTitle = $(this).attr('alt');
alert(getTitle)
});
</script>
</head>
<body>
<img src="http://localhost/wordpress/wp-content/uploads/2013/02/chair-228x300.jpg" alt="alt" width="228" height="300" class="size-medium wp-image-92" />
</body>
</html>
这将基本上在单击后在弹出窗口中显示图像的 alt 属性,但它似乎不起作用。我错过了什么?请帮忙。