$.each(thedata.data, function() {
$('#theReturnFormTable').append(
'<tr id="newReturn"><td align="center"><a href="##" id="link">'+ this.newrequestor
+'<input type="hidden" id="theID" value="'+ this.theid +'"></a></td><td
align="center">'+ this.newthedate +'</td><td>'+ this.theid +'</td><td
align="center">'+ this.newapproved +'</td>
<td align="center">'+ this.newsecurityaction +'</td></tr>'
);
});
结果:
requestor=dave theID = 75
requestor=frank theID = 76
requestor=bill theID = 77
requestor=george theID = 78
requestor=sam theID = 79 and so on.
我在每一行都有链接,无论我点击哪一行,它都会获取 theID = 75,而不是传递该行的 theID 值。我有大脑冻结。任何想法如何为每一行传递 theID 的值?
这是我将ID传递给的地方
$("#link").live("click", function(){
//show layer Div
$("#theHover").show();
alert($("#theID").val());
var instance = new readers_cls();
var theID = $("#theID").val();
newdata = instance.getRequestSecurity(theID);
newrooms = instance.getRequestSecurityRooms(theID);
newcust = instance.getRequestSecurityCust(theID);
我知道它只是进入页面并获取 html 中的第一个 theID。我需要想办法解决这个问题。