콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
4713 화면
<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
1707
1
12월 23
1418
1
4월 23
1586
1
3월 23
2427
0
12월 22
2023