I have created a struts2-jsp application,i want a dialog pop up whenever edit hyperlink in clicked,I am using Jquery to pop up a dialog when Edit hyperlink is clicked.
The problem is that Dialog box pops up only when the first edit is clicked,in the second and other edits which are generated dynamically when a record is added dialog box doesn't pops up.
The Jquery code is:
<script>
$(document).ready(function(){
$( "#todo" ).dialog({ autoOpen: false });
$( "#dialogLink" ).click(function() {
$( "#todo" ).dialog('open');
});
});
</script>
The code to dynamically generate the table is:
<div class="content">
<table class="todoTable" cellpadding="5px">
<tr class=even>
<th>TITLE</th>
<th>STATUS</th>
<th>EDIT</th>
<th>DELETE</th>
</tr>
<!--This will iterate through the todolist -->
<s:iterator value="gettodoList()" status="todoStatus">
<tr class="<s:if test="#todoStatus.odd == true ">odd</s:if> <s:else>even</s:else>">
<td><s:property value="title" /></td>
<td><s:property value="complete" /></td>
<!-- This will append the Id with the url -->
<td>
<a id="dialogLink" href="#">Edit</a>
</td>
<td><s:url id="deleteURL" action="deleteTodo">
<s:param name="id" value="%{id}"> </s:param>
</s:url> <s:a href="%{deleteURL}">Delete</s:a>
</td>
</tr>
</s:iterator>
</tbody>
</table>
</div>