English 中文(简体)
给父母子女投入价值的不确定错误
原标题:Undefined error getting parents childs input value

我有一个这样的表:

<table>
    <tr>
       <td class="packing-vol">0.19</td>
       <td class="qty-cell"><input type="text" name="qty[]" class="qty" value="2" /></td>
     </tr>
     <tr>
       <td class="packing_total">0.70</td>
       <td class="qty-cell"><input type="text" name="qty[]" class="qty" value="1" /></td>
     </tr>
</table>

每一次都发生穿透包装的循环,然后,我想从同一个行走q,这样,我就跑到母体,然后打入.子。 但是,当我发出警告(qty)时,我会得到不明确的信息。

var total = 0;

jQuery( .packing-vol ).each(function(i) {

    var qty = jQuery(this).parent("td.qty-cell .qty").val();
    alert(qty);

    var cur = parseFloat(jQuery(this).text());
    if(!isNaN(cur)){
        total = total + cur;
    }

});
最佳回答

http://www.un.org/Depts/DGACM/index_french.htm 你不能再用它去树木。

<代码> 父母为多级。 你不能再用它去树木。

您可使用<条码>/代码>/<条码>,然后使用<条码>限值/代码>做你想要做的事情,甚至更好:

var total = 0;
jQuery( .packing-vol ).each(function(i) {

    var qty = jQuery(this).parent().children( .qty-cell ).children( .qty ).val();
    alert(qty);

    var cur = parseFloat(jQuery(this).text());
    if (!isNaN(cur)){
        total = total + cur;
    }
});

您也可使用<条码>限定的,但sdown,而不是直接在内部进行,因为它必须搜索OM物体。

但你也可以这样做:

var qty = jQuery(this).parent().find("td.qty-cell .qty").val();
问题回答

我认为你应该这样做:

var qty = jQuery(this).parent().find("td.qty-cell .qty").val();

您需要达到1级(使用. 0000),然后用<代码>找到你的外地。

var qty = jQuery(this).parent("td.qty-cell .qty").val();

Try:

var qty = jQuery(this).parent().find(".qty").val();




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签