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 函数将从显示的表格行中提取所有类型值,并根据您指定的条件执行必要的验证。