开发者

Get element value from multiple table rows generated by js

开发者 https://www.devze.com 2023-02-28 14:33 出处:网络
I\'m generating table in html using js, each row contain two drop down and 1 test box, each drop down has onchange function, my prob is how can I get first drop do开发者_JAVA技巧wn selected value when

I'm generating table in html using js, each row contain two drop down and 1 test box, each drop down has onchange function, my prob is how can I get first drop do开发者_JAVA技巧wn selected value when second drop down is choose in second drop down onchange function.

I tried the below code:

  var r = document.getElementById('AACTVTbl').getElementsByTagName('td')[idx-1].document.getElementById("division").value;
alert(idx+" "+r); 

but just get value from 1st row only.

Can anyone help me?


hmm, finally found solution,

idx= this.parentNode.parentNode.rowIndex
var selectedDivisionId=ele.form.division[idx-1].value;
0

精彩评论

暂无评论...
验证码 换一张
取 消