我有这样的代码jQuery的点击功能不工作当点击图像
$("div").click(function() {
var CurrId = $(this).attr('id');
if (CurrId == "First") {
$("#MenuContent").empty();
$("#MenuContent").hide();
$('<img src="images/End_05.png" width="30" height="30" /> <a id="First" class style="text-decoration:none;color:black">any </a>').appendTo("#MenuContent");
$("#MenuContent").show("slow");
}
});
即当我点击div
的图像(假设它的名字是mm
)和链接出现。现在,我写了这个:
$("img").click(function() {
alert('yes');
});
当我点击图像显示(即mm
)什么都没有。有任何想法吗?
感谢您的答复。 – 2013-04-28 06:45:55