<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <link rel="stylesheet" href="">
  <script src="jquery.js"></script>
</head>
<body>
  <table class="list" style="width:100%;">
        <tbody><tr>
          <th style="width: 20%; min-width: 168px; max-width: 192px;">审核用户</th>
          <th style="width: 20%; min-width: 120px; max-width: 144px;">审核结果</th>
          <th style="width: 20%; min-width: 120px; max-width: 144px;">审核日期</th>
          <th style="width:60%">相关说明</th>
        </tr>
        </tbody><tbody oddclass="list-odd" evenclass="list-even" hoverclass="list-hover" class="shsjvalidation">
          
            <tr>
              <td style="min-width: 168px; max-width: 192px;">
                葛大爷
              </td>
              <td style="min-width: 120px; max-width: 144px;">
                审核中
              </td>
              <td style="min-width: 120px; max-width: 144px;">2017-06-02</td>
              <td style="white-space: inherit; overflow: inherit; text-overflow: inherit;">
                
              </td>
            </tr>
          
            <tr>
              <td style="min-width: 168px; max-width: 192px;">
                a的上级
              </td>
              <td style="min-width: 120px; max-width: 144px;">
                同意
              </td>
              <td style="min-width: 120px; max-width: 144px;">2017-06-02</td>
              <td style="white-space: inherit; overflow: inherit; text-overflow: inherit;">
                
              </td>
            </tr>
          
        </tbody>
      </table>
<script>
    str="审核中";
    var reg = /审核中/ig;
    var shstr = $(".shsjvalidation tr td:nth-child(2)").text();
    console.log(shstr);
    var newshsjstr = $(".shsjvalidation tr td:nth-child(3)").text();
    console.log(newshsjstr);
    $('.shsjvalidation tr td:nth-child(2)').each(function(index){
    // console.log("这是第"+index+"个: "+$(this).html());
    console.log($(this).html());
    if($(this).html().match(str)){
      // alert("ok");
      $(this).next("td").css("background-color","yellow");
      // $('.shsjvalidation tr td:nth-child(2)').css("background-color","yellow");
    }
    })
    
  </script>
</body>
</html>

自行添加jq文件

标签:JavaScript, JS, 正则

你的评论