替换 Colspan = “2"与 Colspan = “4"使用jQuery [英] Replacing Colspan = "2" with Colspan = "4" using Jquery

查看:21
本文介绍了替换 Colspan = “2"与 Colspan = “4"使用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的第一个不使用 JQuery 的完整页面中用 Colspan="4" 替换第一个 Colspan="2".

I want to replace first Colspan="2" with Colspan="4" in my first TR not in complete page using JQuery.

谢谢.

最好的问候,女士

推荐答案

这个 jQuery 应该处理在任何表的第一个 tr 中找到一个 colspan 为 2 的 td 并将其 colspan 设置为 4 的情况.

This jQuery should handle the condition of finding a td with colspan 2 in the first tr of any table and set its colspan to 4.

$("table tr:first td[colspan=2]").attr('colspan',4);

最好的办法是修复您的 HTML 以生成 colspan=4

The better thing to do would be to just fix your HTML to produce colspan=4

这篇关于替换 Colspan = “2"与 Colspan = “4"使用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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