我的代码如下:
<ul class="classul">
<?php
$uid = $_REQUEST['uid'];
include("lib/db_function.php");
$query = "SELECT * FROM tblproject";
$exc = mysql_query($query) or die (mysql_error());
while($val = mysql_fetch_array($exc)){
?>
<li id="li<?php echo $val['projectId']?>"><a href="#<?php echo $val['projectId']?>"><?php echo $val['projectName']?></a></li>
<?php } ?>
<li><img src="images/Plus-icon.png" width="30" height="30" id="addproject"></li>
<input type="hidden" name="uidhide" id="uidhide" value="<?php echo $uid;?>">
</ul>
<?php
$qry ="SELECT * FROM tblproject";
$re = mysql_query($qry) or die (mysql_error());
while($data = mysql_fetch_array($re)){
?>
<script language="javascript">
$(document).ready(function(e) {
var ul = $('.classul li').addClass('<?php echo $data['projectId'];?>');
$("#hideproject<?php echo $data['projectId'];?>").click(function(e) {
ul.remove();
});
});
</script>
<input type="button" name="hideproject" id="hideproject<?php echo $data['projectId'];?>" value="Hide Project">
<?php
}
?>
问题:当我点击按钮隐藏项目时,它会隐藏所有li tag
我需要什么:当我点击按钮 Hide Project 时,我只想隐藏一个li tag
带有我自己生成的 id 的项目php
。