Jquery 通过a循环,但每个函数未知

Jquery 通过a循环,但每个函数未知,jquery,Jquery,我得到json值并循环rentFeatureOption。这部分工作 { "bailId": 2, "fromDate": "2016-03-11", "toDate": null, "lodgerId": 1, "supportTwoPerson": false, "lodgerPayforTwo": false, "roomId": 1, "appartmentId": 1, "price": 500.0,

我得到json值并循环rentFeatureOption。这部分工作

{
    "bailId": 2,
    "fromDate": "2016-03-11",
    "toDate": null,
    "lodgerId": 1,
    "supportTwoPerson": false,
    "lodgerPayforTwo": false,    
    "roomId": 1,
    "appartmentId": 1,
    "price": 500.0,
    "paymentPeriod": "WEEK",
    "address": "460 Ch. Chambly, Longueuil, 1",
    "rentFeatureOption": [{
        "rentFeatureOptionId": 1,
        "featureOptionId": 2,
        "price": 5.0
    }]
}
我需要在html表上循环

<tbody>
    <tr data-index="0" data-rent-feature-option-id="">
        <td style="" data-feature-option-id="1">Air climatisé
            <input type="hidden" name="rentFeatureOption[0].rentFeatureOptionId" value="">
            <input type="hidden" name="rentFeatureOption[0].featureOptionId" value="1">
        </td>
        <td style="">
            <input type="text" name="rentFeatureOption[0].price" value="">
        </td>
    </tr>
    <tr data-index="1" data-rent-feature-option-id="">
        <td style="" data-feature-option-id="2">Internet
            <input type="hidden" name="rentFeatureOption[1].rentFeatureOptionId" value="">
            <input type="hidden" name="rentFeatureOption[1].featureOptionId" value="2">
        </td>
        <td style="">
            <input type="text" name="rentFeatureOption[1].price" value="">                
        </td>
    </tr>
</tbody>

空气气候
互联网
for(var i=0;itbody>tr')。每个(函数(){
if($(this).find('td')[0].data(“功能选项id”)==data.rentFeatureOption[i].featureOptionId{
}
});                        
}
在我得到这个错误的条件下

未捕获的TypeError:$(…).find(…)[0]。数据不是函数


[0]
返回一个dom元素。您可以使用
.first()
eq(0)

您也可以使用一个选择器,而不是两个选择器:

$('#lodgerRentOptionTableResult > tbody  > tr > td:first-of-type').each(function() {            
    if( $(this).data("feature-option-id")==data.rentFeatureOption[i].featureOptionId){

[0]返回的dom元素可能是的重复项