JQuery specific variable from a php printed table -
ive got table buttons:
, ive set specific id's each 1 dont see how can access them jquery script can set specific each 1 of them.
edit:
of buttons have unique ids:
shown in google chrome inspect element :
when click remove want row removed. can , have done php via dont want have refresh page every time remove one. tested doing jquery .get , works fine dont want have make new script have delete every single row, rather dynamically getting id of row , removing row remove button in. ive tried multiple ways of doing fail.
this script prints data in table
function print_data($info1,$info2,$info3,$info4,$info5,$info6,$info7,$info8){ echo"<tr><td id='notice1id$info8'>$info1</td><td id='noticename$info8'>$info2</td><td id='noticetype$info8'>$info3</td><td id='noticecontent$info8'>$info4</td><td id='noticeshow$info8'>$info5</td><td id='noticeedit$info8'><a href='admincp.php?edit=1&editid=$info6'><div class='btn btn-success'>edit</div></a></td><td id='noticeremove$info8'><input type='button' id='remove$info8' value='remove' onclick='removeme();' class='btn btn-danger' name='$info8'></td><td style='display:none;'><p id='getid' name='$info8' style='display:none;'></p></td><td style='display:none;'><script> function removeme() { alert($info8);}</script></td><input id='noticeid$info7' class='form-control' style='display:none;' type='text' name='$info8' value=$info7></td></tr>"; ?><?php } while($row = mysqli_fetch_array($result, mysqli_assoc)){ print_data($row['noticeid'],$row['noticename'],$row['noticetype'],$row['noticecontent'],$row['noticeshow'],$row['noticeid'],$row['noticeid'],$row['noticeid']); }
javascript:
$(document).ready(function () { var id = $("#getid").attr("name"); alert("#remove" + id); $("#remove" + id).click(function () { var getcontent = $("#noticeid4").val(); $("#notice1id5,#noticename5,#noticetype5,#noticecontent5,#noticeshow5,#noticeedit5,#noticeremove5").slideup(300, function () { // animation complete. }); }); });
Comments
Post a Comment