我有一个元素的路径如下。jQuery - 按元素路径查找元素
html:eq(0)>body:eq(0)>div#header>div#blueAreaCommon>div#titledescription>div.title>a:eq(0)
现在我需要更改该元素的文本。所以我做了如下。
$(document).find("html:eq(0)>body:eq(0)>div#header>div#blueAreaCommon>div#titledescription>div.title>a:eq(0)").html("Some text");
但它不起作用。有没有解决方法?
谢谢!
,因为你有这么多的元素的ID为什么要这样 –
它可以简单如'$('格# titledescription> div.title> a:eq(0)')。html(“Some text”);' –
我会简单地做'$('#titledescription .title a:first-child')。text('some text ');' – Praveen