我有一个搜索按钮。单击搜索按钮时,它将生成以下代码:
<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/>
这段代码在循环内,循环进行了两次,循环的结果是这样
<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>
如果单击其中一个表,它将执行此操作(我使用 jquery)
$(".clickedResult").click(function()
{
$('.clickedResult input.form_id').each(function()
{
alert($(this).val());
});
});
它会提醒 14 和 48 ......如果我点击第一个表,如何只提醒 14 ?如果我点击第二个表,它会提醒 48 ?