how to click the append a into li > p ?
hi
before this post i post a question how to click the append p into li
now i'm asking how to click the a into li > p
this is my code and when i click the info or picture i get double alert message one for the p click and the second one for the a click so i want to have one alert for p and one for a thsi is my JQ :
Code:
$.getJSON('../test/11.php',function(json){
$.each(json.wing_i,function(i,post){
var dv = $('<a style="display:none;"></span>')
.text(' Pictures ')
.attr('href','#')
.attr('id',post.w_id)
.addClass('red_ok');
var dv2 = $('<a style="display:none;"></a>')
.text(' Info ')
.attr('href','#inline1')
.attr('id','various1')
.addClass('red_ok');
var p = $('<p></p>', {href:"#",name: post.w_id, id: post.w_id})
.text(post.w_name)
.addClass('f_ok');
$('#li_x').append(p);
p.hover(function(){
$(this).append(dv.fadeIn(400)).append(dv2.fadeIn(400));
},
function(){
$(this).find(dv).fadeOut(100);
$(this).find(dv2).fadeOut(100);
});
});
$('li p').live('click', function() {
alert($(this).attr('id')+' p');
});
$('li p a').live('click', function() {
alert($(this).attr('id')+' a');
});
});
and this is my html
Code:
<body>
<ul id="ul_x">
<li id="li_x">
<h2>wings</h2>
</li>
</ul>
</body>