开发者

Get parent node name

How to get开发者_运维知识库 the parent node name of the checked child node of ASP.net TreeView Control using jQuery/JavaScript ?

$('#<%=treeMeasures.ClientID%>').find('input[type=checkbox]').each(function() {
                        alert($(this).parent().text());
                    });


If you're willing to get the parent node use $(this).parent().get(0)

if you just need the tag name of the parent Element try $(this).parent().get(0).tagName


The .parent() function is used to access an elements immediate parent.

You can also use .parents() to access parent elements further up in the ancestry.

You can also include an optional parameter for a filter to a specific selector in either case.


Not really a jQuery guru, but if you need to access the id of the parent you could try using

 $(this).parent().attr('id')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜