跳至內容
選單
此問題已被標幟
4 回覆
4693 瀏覽次數
<t t-foreach="values" t-as="value">
<input type="hidden" t-att-value="value.editor1" id="aaa"/>

<script type="text/javascript">

var a= document.getElementById("aaa").value;

alert(a);
document.getElementById("kkkr").innerHTML = a;
</script>

<span id="kkkr"> </span>

here iam getting only first record every time

How to get all records present in the table
頭像
捨棄

log your values, whether its a dict or record

作者

Yes these are dict values

I am getting only first record of table

作者

Every time pf fpr loop my javascript getting only first recod insted of pointing to next id

最佳答案

In your example foreach has every time the same input tag with id = "aaa". Many input lines (not array), but only one id. In this case Method

getElementById("aaa")

returns each time the value of the first line.   Change it to ... for example:  'aaa' + value.id
or organise as array.

 


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
6月 24
1702
1
12月 23
1405
1
4月 23
1576
1
3月 23
2394
0
12月 22
1978