jQuery部分选择器 [英] jQuery Partial Selectors

查看:64
本文介绍了jQuery部分选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多表,这些表有嵌套表.我使用jQuery隐藏一些表单元格,因为数字为空或内容无关.

I have a number of tables, which have nested tables. I using jQuery to hide some of the table cells as a number are empty or the contents irrelevant.

我使用jQuery隐藏所有TD,然后使用jQuery显示它们,例如,如果它们包含<P>.

I use jQuery to hide all TD's and then jQuery to show them, for instance, if they contain a <P>.

不幸的是,某些TD不含任何东西,但仍需要显示. TD的类是动态的,因此我将无法全部为它们编写代码(有意义的),但是它们都以"Node"结尾

Unfortunately some of the TD's don't contain anything but still need to be shown. The class the TD's are given is dynamic so I wont be able to code for them all (Sensibly) however they do all end 'Node'

我想知道是否可以做类似的事情...

I was wondering if its possible to do something like...

$(function() {
   $('TR .*Node').css('display','inline');
});

推荐答案

这将选择其类名中带有Node somewhere 的任何tds.

This will select any tds with Node somewhere in their class name.

$('td[class*=Node]').css('display','inline');

这将选择所有在其类名后带有Node 的tds.

This will select any tds with Node at the end of their class name.

$('td[class$=Node]').css('display','inline');

请记住,.show()的作用与.css('display','inline');

这篇关于jQuery部分选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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