jquery - 如何排除具有特定 ID 的表?
问题描述
我需要 jQuery 的帮助。
我需要在我的if
声明中添加表格不能有id
“pippo”的条件。
我的if
声明如下:
if (
HtmlPath.indexOf('ZOSHTML/DTREND') > -1 ||
HtlPath.indexOf('LNXHTML/DTREND/LDRSYS.') > -1 ||
HtmlPath.indexOf('LNXHTML/DTREND/LDMAIN.') > -1 &&
// put here the condition that the table must not contain the ID pippo
) {
$("table.NAVREP").epvMinMax();
}
解决方案
您可以使用 jQueryattr
函数来检查该id
属性是否不是“pippo”:
if (
HtmlPath.indexOf('ZOSHTML/DTREND') > -1 ||
HtmlPath.indexOf('LNXHTML/DTREND/LDRSYS.') > -1 ||
HtmlPath.indexOf('LNXHTML/DTREND/LDMAIN.') > -1 &&
$('table').attr('id') != 'pippo'
) {
$('table.NAVREP').epvMinMax();
}
推荐阅读
- javascript - 使用来自 html 表单的多个输入作为 url 中的变量进行 ajax 调用
- ios - Objective-Git 的拉/推问题
- c# - 如何更新母版页中的用户控件
- java - 如何创建一个指定用于存储数组的类,然后从任何其他方法调用它?
- python - Python Tkinter Mysql select 语句返回字符串周围的花括号
- haskell - 了解用于在 Haskell 中定义组合子和表达式 (Lambda) 的 eval 函数
- html - 使用 100% 宽度时徽标太大
- android - 如何以编程方式在 Android 中获取 wifi 信号强度?
- javascript - 如何使图像“安全”并防止用户复制图像 url 并将其发送给另一个用户?
- android - 在 Android 中,屏幕旋转活动正在重新创建,即使 Oneplus6t(android 9)上的清单中阻止了旋转?