How to get corresponding label value when i click on it for following jsp using javascript
This is my jsp page.
<%
for( int i = 0; i < sam.groupName.length; i++ ) {%>
<a href='JavaScript:validation();'>
<img src='registerButton.jpg'>
<label for='groupsId' id='labeld"+i+"'><%=sam.groupName[i]%>" </label>
</a>
<% } %>
<script type="text/javascript">
function validation(){
alert("script");
}
</script>
(this will pass the
<a>element as the first argument tovalidation())and then