Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用jQuery选择子元素_Javascript_Jquery_Jquery Selectors - Fatal编程技术网

Javascript 使用jQuery选择子元素

Javascript 使用jQuery选择子元素,javascript,jquery,jquery-selectors,Javascript,Jquery,Jquery Selectors,我正在尝试使用jQuery快速选择页面上的元素。这是迄今为止的代码: $('#row-58708 > div.cell name > div > strong').html('tesing'); 这是标记: <div id="row-58708" class="row"> <div class="cell name"> <div> <strong>Skin name</str

我正在尝试使用jQuery快速选择页面上的元素。这是迄今为止的代码:

$('#row-58708 > div.cell name > div > strong').html('tesing');
这是标记:

<div id="row-58708" class="row">
    <div class="cell name">
        <div>
            <strong>Skin name</strong>
        </div>
    </div>
</div>

皮肤名称

我知道我写的离目标很远,但我无论如何也做不出来。。。谁能帮帮忙吗?干杯

实际上,您并不遥远,只是没有正确使用多类选择器:

$('#row-58708 > div.cell.name > div > strong').html('tesing');

在您的版本中,您有
div.cell name
,字面意思是“选择一个类单元格div中的所有
name
标记”。当然,没有名称标记,但您看到了重点。

您实际上离得不远,只是没有正确使用多类选择器:

$('#row-58708 > div.cell.name > div > strong').html('tesing');
$('.row').find('strong').html('tesing');
在您的版本中,有
div.cell name
,字面意思是“选择类cell的div中的所有
name
标记”。当然,没有名称标记,但您看到了要点

$('.row').find('strong').html('tesing');
检查工作示例
检查上的工作示例,我认为您希望将皮肤名称更改为测试。如果是,请使用:

$('#row-58708 strong').html('testing')

我认为您想将皮肤名称更改为测试。如果是,请使用:

$('#row-58708 strong').html('testing')

不知怎的,我以前从来没有注意到右箭头符号——这是一个巨大的帮助(并且更清楚地看到点符号)。不知怎的,我以前从来没有注意到右箭头符号——这是一个巨大的帮助(并且更清楚地看到点符号)