开发者

Why $(parent).children(class) doesn't return element?

var parent = $(this).parent().parent().parent().parent().next().attr("id");

alert ($("#"+parent).child开发者_如何学Goren(".select_tarif").get());

I try to retrieve elements, with parent and class (I can't use only the class, because I have other elements with same class, but variant parent).

The way to retrieve the parent is ugly, but I can't do otherwise (html is generated) and it return what I want.

My problem is, function alert() returns nothing, but it will display element is a select input


Use:

$("#"+parent).find(".select_tarif")


You don't need to use another selector (and find is better)

var parent = $(this).parent().parent().parent().parent().next();

alert (parent.find(".select_tarif").get());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜