我有几个表格行和表格,其中包含隐藏的输入字段和值。我需要做的是遍历所有隐藏的输入字段并找到一个特定字段,其中 class = 'something' 和 value = something 并转到 <td>
该输入字段并更改背景颜色。
$('input:hidden').each(function(){
if( $(this).find(".id_schedule_hours") && $(this).val() == 1) {
console.log('here')
}
}
最佳答案
.each()
不是必需的;你可以使用属性选择器,.closest()
$("input:hidden[class='something'][value='something']")
.closest("td").css("backgroundColor", /* color */)
关于javascript - jquery 查找所有具有特定类名的隐藏输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38679178/