为什么javascript/jQuery不能获得parentNode?

Voi*_*ing 3 html javascript jquery click

考虑到我有这样的元素:

<p class="ELP">2/1/2013 - <a id="EL3" class="ELLink" href="/Event htms/Event.cshtml?title=Okmulgee Public Schools County Professional Day&amp;explanation=Okmulgee Public Schools County Professional Day.&amp;dateString=2-1-2013">City Public Schools County Professional Day</a></p>
Run Code Online (Sandbox Code Playgroud)

为什么这个JavaScript/jQuery工作......:

$(".ELP").click(function (){
        var stringDate = $(this).text().substring(0, 8)
        console.log(stringDate)
    });
Run Code Online (Sandbox Code Playgroud)

Console.log生成:2013年2月1日

...而这个JavaScript/jQuery没有?

$(".ELLink").click(function (){
        var stringDate = $(this).parentNode.text().substring(0, 8)
        console.log(stringDate)
    });
Run Code Online (Sandbox Code Playgroud)

由于JavaScript错误,Console.log不产生任何内容:未捕获的TypeError:无法调用未定义的方法"text"

很明显,我可以看到它不是"获得"正确的元素,但为什么呢?不是'a'元素的第一个父节点'p'元素?据我所知,没有(至少没有跨浏览器/平台兼容)的有效css选择器用于元素的直接父节点,或者我只会使用它.

我没看到什么?

Ibu*_*Ibu 7

jQuery方法称为parent()

$(".ELLink").click(function (){
        var stringDate = $(this).parent().text().substring(0, 8)
        console.log(stringDate)
    });
Run Code Online (Sandbox Code Playgroud)