Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
4663 มุมมอง
<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.

 


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 24
1693
1
ธ.ค. 23
1394
1
เม.ย. 23
1560
1
มี.ค. 23
2386
0
ธ.ค. 22
1972