我正在寻找提供父级名称的元素。这:
$('.Item').click(function(){
var a = $(this).parent();
alert(a[0].tagName);
});
只是说“DIV”,但我需要元素的真实名称。谢谢
尝试以下操作(提醒标签名称,然后提醒真实姓名):
I used $(a[0]).attr('name');
e.g.
$('.Item').click(function() {
var a = $(this).parent();
alert(a[0].nodeName.toLowerCase()); //Tag Name
alert($(a[0]).attr('name')); //Attribute (real) name
//OR
alert(a.attr('name')); //Attribute (real) name
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)