gpt4 book ai didi

javascript - 如何使用多个条件查找行

转载 作者:行者123 更新时间:2023-12-01 03:29:27 24 4
gpt4 key购买 nike

这是一个 getData 方法,我无法使用多个条件获取行。因为我正在尝试设置行条件匹配的输入值。但它还没有工作

function getData() {

$.ajax({
type: 'POST',
url: APIUrl + 'api/GetCustomerProductDetailsDetailByEmployeeID?JSONStringData=' + JSON.stringify(objReqCustomerProductDetails),
dataType: 'json',
contentType: 'application/json; charset=utf-8',
crossDomain: true,
success: function (data, textStatus, xhr) {
objResCustomerProductDetails = data;

if ($(objResCustomerProductDetails.CustomerProductDetails).length > 0) {

$.each(objResCustomerProductDetails.CustomerProductDetails, function () {

$('#tbCustomer tbody tr[data-id=' + this.CustomerID + ' data-product-id=' + this.ProductID + '] td').find('input').val(parseFloat(this.Quantity.toString().trim()).toFixed(2));

});
}

},
error: function (xhr, textStatus, errorThrown) {

messageProvider(0, errorThrown);
}
});
}

最佳答案

$('#tbCustomer tbody tr[data-id=' + this.CustomerID + '][data-product-id=' + this.ProductID + '] td').find('input').val(parseFloat(this.Quantity.toString().trim()).toFixed(2));

属性结束后,您需要关闭它。约定为[attr1][attr2]。这是上面代码的问题。

引用号:https://api.jquery.com/multiple-attribute-selector/

关于javascript - 如何使用多个条件查找行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44617740/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com