Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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
Jquery 选择表td在索引之间的范围索引_Jquery_Html - Fatal编程技术网

Jquery 选择表td在索引之间的范围索引

Jquery 选择表td在索引之间的范围索引,jquery,html,Jquery,Html,每行td介于02~04之间。是,您可以通过以下方式执行: $('table td').css('color' ,'red'); 片段 $(函数(){ $(“表tr”)。每个(函数(){ $(this.find(“td:gt(0)”).css('color','red'); }); }); 00 01 02 03 00 01 02 03 您可以使用 将匹配的元素集减少为与选择器匹配或通过函数测试的元素集 $(函数(){ $(“表td”).filter(函数(){ var te

每行td介于02~04之间。

是,您可以通过以下方式执行:

$('table td').css('color' ,'red');
片段

$(函数(){
$(“表tr”)。每个(函数(){
$(this.find(“td:gt(0)”).css('color','red');
});
});

00  01  02  03 
00  01  02  03 
您可以使用

将匹配的元素集减少为与选择器匹配或通过函数测试的元素集

$(函数(){
$(“表td”).filter(函数(){
var text=parseInt($(this).text(),10);

返回text>=2&&text=2&&text只是为了确认,
索引
?@Satpal:我怀疑这是否重要。文本值仅基于索引。。。
$('table td').css('color' ,'red');
$(function () {
  $("table tr").each(function () {
    $(this).find("td:gt(0)").css('color' ,'red');
  });
});
$(function () {        
    $("table td").filter(function () {
        var text = parseInt($(this).text(),10); 
        return  text >= 2 && text <= 4;
    }).css('background-color' ,'red');;
});