dtcaw02086
2017-11-18 19:59
浏览 151
已采纳

在PHP表格单元格中为特定单词添加颜色

I want to color the word "Pizza" in class "status", which is inside my HTML table, which gets data from a database with PHP.

      <!-- populate table from mysql database -->
        <?php
        while($row=mysqli_fetch_array($records))
        {
            ?>
            <tr>
            <td class="status"><?php echo $row['pojem'];?></font></td>
            <td><font color="brown"><?php echo $row['kratica'];?></font></td>
            <td><font color="brown"><?php echo $row['nem'];?></font></td>
            </tr>
            <?php
        }
    ?>

I have tried the following but it doesn't work

<script>
$('.status:contains("Pizza")').css('color', 'red');
</script>
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题