JQUERY更改TD样式仅当其包含输入类型=文本(而不是输入类型=无线电) [英] JQUERY Change TD style ONLY IF IT contains input type = text (and not input type=radio)

查看:287
本文介绍了JQUERY更改TD样式仅当其包含输入类型=文本(而不是输入类型=无线电)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经应用了以下样式,它对我很有用:

I have applied a style as follows and it works great for me:

$("td[id='cellId']").css("text-align", "left");

但是,我需要的样式只适用于TD IF,它包含文本框和NOT单选按钮。

However, I need that style to only be applied to the TD IF it contains textboxes and NOT radio buttons.

我已搜索hi和low,但 find() contains

I have searched hi and low, but find(), contains() and the likes, does not seem to be working.

推荐答案

使用::has() selector来匹配包含其他元素的元素。

Use the :has() selector to match elements that contain other elements.

$("td#cellId:has(:text)").css("text-align", "left");

这篇关于JQUERY更改TD样式仅当其包含输入类型=文本(而不是输入类型=无线电)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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