Side navigation
Ticket #5378: test_events.html
File test_events.html, 1.1 KB (added by the_hero, October 14, 2009 09:33PM UTC)
Test this code to see this occurring
<style type="text/css">
.parentC{width:350px; background:#ccc; border:1px solid #000; height:200px;}
.child1-0{width:40%; float:left; border:1px solid #999; background:#ff0000; height:125px;}
.child1-1{width:40%; float:right; border:1px solid #999; background:#ff0000; height:125px;}
.child2-0{width:40%; float:left; border:1px solid #999; background:#fff; height:75px;}
.child2-1{width:40%; float:right; border:1px solid #999; background:#fff; height:75px;}
</style>
<div id="parentD" class="parentC">Parent
<div id="child0" class="child1-0">Child 0</div>
<div id="child1" class="child1-1">Child 1
<div id="child1_0" class="child2-0">Child 1.0</div>
<div id="child1_1" class="child2-1">Child 1.1</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#parentD').click(function(){
alert($(this).attr('class'));
});
$('#child0').click(function(){
alert($(this).attr('class'));
});
$('#child1').click(function(){
alert($(this).attr('class'));
});
$('#child1_0').click(function(){
alert($(this).attr('class'));
});
$('#child1_1').click(function(){
alert($(this).attr('class'));
});
});
</script>
Download in other formats:
Original Format
File test_events.html, 1.1 KB (added by the_hero, October 14, 2009 09:33PM UTC)
Test this code to see this occurring
<style type="text/css">
.parentC{width:350px; background:#ccc; border:1px solid #000; height:200px;}
.child1-0{width:40%; float:left; border:1px solid #999; background:#ff0000; height:125px;}
.child1-1{width:40%; float:right; border:1px solid #999; background:#ff0000; height:125px;}
.child2-0{width:40%; float:left; border:1px solid #999; background:#fff; height:75px;}
.child2-1{width:40%; float:right; border:1px solid #999; background:#fff; height:75px;}
</style>
<div id="parentD" class="parentC">Parent
<div id="child0" class="child1-0">Child 0</div>
<div id="child1" class="child1-1">Child 1
<div id="child1_0" class="child2-0">Child 1.0</div>
<div id="child1_1" class="child2-1">Child 1.1</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#parentD').click(function(){
alert($(this).attr('class'));
});
$('#child0').click(function(){
alert($(this).attr('class'));
});
$('#child1').click(function(){
alert($(this).attr('class'));
});
$('#child1_0').click(function(){
alert($(this).attr('class'));
});
$('#child1_1').click(function(){
alert($(this).attr('class'));
});
});
</script>