0

i am trying to get html from the the list of li finding which one is display block and get that li's html. all i want is to get the html from the display:block li out of four li

 if ($('.fishes li').is(':visible'))
 {
 var price=$(this).find('span').html();
 alert(price);
 }

but using this is not getting the value i want . its not taking out html from the display:block li . the click source is different.

the click source is $(document).on("click", ".test", function()

4

2 回答 2

0

在您发布的代码中,$(this)指的是.test元素。试试这个:

$(document).on("click", ".test", function() { 
    console.log($('.fishes li:visible').find('span').html());
});
于 2013-01-15T21:10:00.693 回答
0

通过使用这$(".fishes li:not(.hidn)").find("span:first").html();对我有用,将它分享给一些帮助谢谢

于 2013-01-15T21:19:43.247 回答