Here is the code I used:
<% int number=0 %>
<logic:iterate name="sample" id="sample1" property="lstWaferRequests" indexId="rowid">
<tr>
<% number= (rowid.intValue())+1;%>
<td>
<html-el:text name="sample1" property="strExpDate" styleId='<%="Date"+number%>'/>
</td>
<script>
var x=document.getElementById("<%="Date"+number%>");
</script>
<a href="javascript:show_calendar(x,'');">
<img src="images/calendar.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
</td>
</tr>
</logic:iterate>
I tried to increment a variable(number) and add it to the id of sample1 textbox
but the id is not changing for the next iteration. I checked it using the Inspect Element option in IE11
.
I used setatttribute()
method in javascript to set ID but I got an error that,
object does not support setattribute method.
I need to change the ID of the text box which stores the date value(sample1) dynamically since I need to pass it as an argument to show_calendar
method.
Please advise.