jQuery查找具有值的表单元格 [英] jquery find table cell with value

查看:123
本文介绍了jQuery查找具有值的表单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ID为趋势表的表.我想要与网页粉丝"完全匹配的单元格

I have a table with id trends_table. I want the cell with the exact match of "Page Fans"

 $j("#trends_table td:contains('Page Fans')")

这给了我所有包含的单元格,我怎么做等于?我摆弄了一堆语法,但找不到任何作品.

This gives me all cells that contain, how do I do equals? I have fiddled with a bunch of syntax but nothing I can find works.

我看到了, jQuery查找表单元格,其中值是X ,但看不到如何处理给定的表,也不了解上下文.

I see this, Jquery find table cell where value is X but dont see how I would do it for a given table, dont understand the context.

谢谢 乔尔

推荐答案

$('#trends_table td').filter(function() {
    return $(this).text() == 'Page Fans';
}).css('background-color', 'red');

这里是您尝试完成的示例. http://jsfiddle.net/bQdpp/1/.在此示例中,我只是将单元格设为红色,请注意然后返回1个单元格,然后所有单元格都变成红色.

Here is an example of what you try to accomplish. http://jsfiddle.net/bQdpp/1/ .In this example I just turn the cells red, take care if more then 1 cell is returned then all the cells are turned red.

这篇关于jQuery查找具有值的表单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆