我需要做的是如何传递id依赖于行的id来打开模态框内部?我需要在表格中进行编辑。我的桌面下面有我的php mysql记录。但我怎么能通过身份证?任何帮助将不胜感激!
<table width="70%" border="0" cellpadding="0" cellspacing="0" class="table-list">
<tr>
<th width="40%">Item</th>
<th width="20%">Category Code</th>
<th width="20%">Item Code</th>
<th width="20%">Edit</th>
<th width="20%">Delete</th>
</tr>
<?php
$res = $mysqli1->query("select * from code order by item_code ASC");
while($r = $res->fetch_assoc()){
echo "<tr>
<td>".$r['item']."</td>
<td>".$r['cat_code']."</td>
<td>".$r['item_code']."</td>
<td><a href='item_edit.php?id=".$r['id']."'</a></td>
<td><a href='#' id='".$r['id']."' class='del'>Delete</a></td>
</tr>";
}
?>
<div class="entry-form">
<form name="userinfo" id="userinfo">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2" align="right"><a href="#" id="close">Close</a></td>
</tr>
<tr>
<td>Item</td>
<td><input type="text" name="items" id="items" value="" class="inputs" autocomplete="off"></td>
</tr>
<div>
的Javascript
$(document).ready(function(){
$("#add_new, #edit").click(function(){
$(".entry-form").fadeIn("fast");
});
$("#close").click(function(){
$(".entry-form").fadeOut("fast");
});
});
答案 0 :(得分:0)
您可以尝试以下想法:
&lt; a href =&#34;#&#34; ID =&#34; someElement&#34;数据-ID =&#34; idVal&#34;&GT;从自定义属性&#39; data-id&#39;中获取值&LT; / A&GT;
var someVariable = $(&#34;#someElement&#34;)。data(&#34; id&#34;);