Hi guys,
I have this bit of code which I am not sure if it is possible what I need to do, if you check the input type 'hidden', you will see this (id="'inpTdId'+ tdIndex" value="tdRegularMedicine_+ inpTdId"
) as I need to get the input hidden to store a new value and id for each time the loop goes through.
I am trying to generate a new element each time it goes through the loop, with a new id and a new value.
I need to do this so I can store the id of another element as value of the hidden item, in order to be able to display and focus that element later on.
Is it possible to do this"?
Code eg(I might have some mistakes on code but I have done it quick, just for you to get and Idea, I apologise if I have any)
<script type="text/javascript">
var tdIndex = 0;
</script>
for (x=0;x<noOfObj;x++{
<script type="text/javascript">
var b = ""
b = "tdRegularMedicine_" + tdIndex;
</script>
<tr>
<td align="left" style="padding-left:2px;">
<input type="hidden" id="'inpTdId'+ tdIndex" value="tdRegularMedicine_+ inpTdId" />
</td>
</tr>
<script type="text/javascript">
var obj = document.getElementById("inpTdId"+tdIndex);
alert(obj.value);
tdIndex++;
</script>
}
Thanks.