http://medfor.petersenuploads.co.uk/product.php/698/2/clear-ps-honey-jar-with-metal-screw-cap
当前屏幕中间有一组下拉菜单和一个选项卡(完整产品列表)。如果您单击完整产品列表中的产品之一,它会更新下拉列表。这包括一个隐藏字段(每个案例的项目)
我想要做的是根据 3 个选定的下拉菜单获取每个案例的项目(从表中)的值。例如:
选择 100ml,无菌 R,无标签 - 这与表中的第二行匹配。我想从表中获取“每箱物品”的值,以便我可以设置隐藏的下拉列表(每箱物品)并获取要添加到购物篮的正确产品。
执行此操作的代码在 script.js 中
// Handles changing any drop downs in the product selection area and updates the choosen item based on label names and field values.
$('.product-options select').change(function() {
$('p.selection-item').text("");
$('#selection-name').text($('header>h1').text());
$('.product-options select').each(function (i) {
$('p.selection-item').append($("label[for='"+$(this).attr("id")+"']").text() + " " + $('option:selected', this).text(), "<br />");
var tableRow = $(".product-table td").filter(function() {
return $(this).text() == "50";
//Needs to match against all drop down values
}).closest("tr");
console.log(tableRow);
});
$('div.product-selection h2').removeClass('noshow');
$('div.product-selection p').removeClass('noshow');
recalcPrice($('#pid').val());
});
我需要过滤表以获取单行,然后获取倒数第二列的值。我怎样才能做到这一点?