Сообщение от NeVirus
|
при клике на div
|
так и берите id того дива к которому привязан клик ...
2 варианта $(this).attr('id') или event.delegateTarget.id
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript">
</script>
<script type="text/javascript">
$(function () {
$("#apDiv1").click(function (event) {
alert("event.target.id : "+event.target.id
+"\n$(this).attr('id') : "+$(this).attr('id')
+"\nevent.delegateTarget.id : "+event.delegateTarget.id);
});
});
</script>
<meta charset="utf-8">
<title>Документ без названия</title>
<style type="text/css">
#apDiv1 {
position:absolute;
width:400px;
height:215px;
z-index:1;
background-color: #0000FF;
}
#apDiv2 {
position:absolute;
width:355px;
height:173px;
z-index:1;
background-color: #FFFF00;
left: 25px;
top: 16px;
}
</style>
</head>
<body>
<div id="apDiv1">
<div id="apDiv2">Click<img src="http://javascript.ru/forum/images/ca_serenity/misc/logo.gif"
border="0" alt=""></div>
</div>
</body>
</html>