2012-12-09 25 views
0

我似乎無法能夠理解這一點,我有一個each循環內部這段代碼:設定值

$('#prices_table tbody tr:last').children().eq(2).val("Y U NO WORK?!"); 

現在上面的代碼簡化版,工作,但如果我嘗試設置文本或HTML它確實指定了權利,並更改文本,但設置值似乎不起作用。

針說特定的元素是一個文本輸入。

this疑問,筆者似乎能夠使其與尋址單元的ATTR,意思是工作看到:

$('#prices_table tbody tr:last').children().eq(2).attr("value","Y U NO WORK?!"); 

但是,這也不能工作。我的頁面上沒有錯誤,任何想法可能是什麼問題?

我應該提到然後被尋址的元件是由克隆創建1線以上使用:

$('#prices_table tbody tr:first').clone(true).appendTo('#prices_table').show(); 

如果它的事項,這是該元件的HTML:

<input class="itext product_prices_inputs" type="text" name="prices[]" value="0"/> 

而我的代碼在(document).ready內運行。

由於我大部分代碼是用PHP生成,這是特定tr的outputed HTML:

<tr style=""> 
<td> 
<select class="iselect pricelist_products_select" name="pricelist_product[]" > 
    //very big select 
    </select> 
</td> 
<td class="product_price">85</td> 

<td> 
<input class="itext product_prices_inputs" type="text" name="prices[]" value="0"> 
</td> 
<td> 
<a href="#" class="delete_price">delete</a> 
</td> 
</tr> 
+0

我將它設置在輸入上。 –

+0

請顯示標記。他們是''還是'