JS中获取JSP页面display:column属性的值

问题描述 投票:0回答:1
javascript jsp jsp-tags
1个回答
0
投票
function next2() {
var types = []; 


$('.your-table-selector').find('tr').each(function() {
    
    var type = $(this).find('td:eq(1)').text().trim(); // Assuming type is in the second column (index 1)

    
    types.push(type);
});

if (types.length > 1 && (types.includes('Mail Addresss') || types.includes('Ordinary'))) {
    alert("You must select at least a PDF for Mail Addresss or Ordinary type for the stakeholder");
    return false;
}}

将“.your-table-selector”替换为适合您的表的选择器。此代码假定类型值显示在表的第二列中。如果列位置不同,请调整 td:eq() 中的索引。

此 JavaScript 函数将从显示的表格行中提取所有类型值,并根据您指定的条件执行必要的验证。

© www.soinside.com 2019 - 2024. All rights reserved.