i have a search button. when the search button is clicked, it will generate this code :
<div class = 'clickedResult' title = 'click to see details'>
<table>the result will br written in this table </table>
<input type = 'hidden' class = 'form_id' value = '$form_id' />
<input type = 'hidden' class = 'status' value = '$status' />
</div> <br/>
this code is inside loop, the loop goes twice and the result of the loop is this
<div class = 'clickedResult' title = 'click to see details'>
<table>the result will br written in this table </table>
<input type = 'hidden' class = 'form_id' value = '14' />
<input type = 'hidden' class = 'status' value = 'latest' />
</div>
<div class = 'clickedResult' title = 'click to see details'>
<table>the result will br written in this table </table>
<input type = 'hidden' class = 'form_id' value = '48' />
<input type = 'hidden' class = 'status' value = 'updated' />
</div>
if one of the table is clicked, it will do this (i use jquery)
$(".clickedResult").click(function()
{
$('.clickedResult input.form_id').each(function()
{
alert($(this).val());
});
});
it will alert 14 and 48… how to alert only 14 if i click the first table ? and if i click the second table it will alert 48 ?
1 Answer