Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/456.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/jquery/87.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_Selector - Fatal编程技术网

Javascript 将jquery选择组合到已定义选择上的排列操作 我有以下代码:

Javascript 将jquery选择组合到已定义选择上的排列操作 我有以下代码:,javascript,jquery,selector,Javascript,Jquery,Selector,我希望tr:nth child(odd)只对以'tr[id^=“part”]”开头的表行执行 我该怎么做?我是个新手,需要一些帮助 $('tr[id^="part"]:nth-child(odd)').addClass("alt"); 您可以尝试使用选择器: $('tr[:nth-child(odd)][id^="part"]').addClass("alt"); $('tr[:nth-child(odd)][id^="part"]').addClass("alt");

我希望
tr:nth child(odd)
只对以
'tr[id^=“part”]”开头的表行执行

我该怎么做?我是个新手,需要一些帮助

$('tr[id^="part"]:nth-child(odd)').addClass("alt");
您可以尝试使用选择器:

$('tr[:nth-child(odd)][id^="part"]').addClass("alt");
$('tr[:nth-child(odd)][id^="part"]').addClass("alt");