1
I have the following div
:
<div id="div_conteudo" align="center">
<div id="header">
<input type="button" name="Delete" class="botao1" style="float: right; margin-right:-12%">
</div>
<div id="foot" style="overflow: auto; width: 100%; height: 440px; border:solid 1px">
<section id="s1">
<div class="div1" id="minhaDiv" style="float: left;">
<table id="table" class="table table-bordered">
<tr>
<th width="20%" style="text-align:center">De</th>
<th width="60%" style="text-align:center">Assunto</th>
<th width="10%" style="text-align:center">Prioridade</th>
<th width="10%" style="text-align:center">Recebido</th>
</tr>
<?php
while($row = mysqli_fetch_array($result))
{
?>
<tr>
<th width="10%" colspan=4>Recebido: <?php echo $row["Data"]; ?></th>
</tr>
<tr>
<td><?php echo $row["De"]; ?></td>
<td class="td-info view_data" id="<?php echo $row["Id"]; ?>,<?php echo $row["Para"]; ?>" data-toggle="modal" href="#dataModal" width="20%" <?php echo $row["Status"] != '0'?' style="font-weight:bold" ':' style="font-weight:normal" '?>><?php echo $row["Assunto"]; ?></td>
<td><?php echo $row["Prioridade"]; ?></td>
<td><?php echo $row["Hora"]; ?></td>
</tr>
<?php
}
?>
</table>
</div>
</section>
</div>
</div>
JavaScript
to select line:
var tr = $('table tr:not(:first-child)');
tr.on('click', function () {
var self = this;
tr.each(function(){
if(this == self) $(this).toggleClass('colorir');
else $(this).removeClass('colorir');
})
});
Within the div id="header"
I have the button that will be to do delete
of the table row, which is within the div id="foot"
. Now I can’t get the button to delete
working.
I don’t understand... which line you want to delete by clicking the button?
– JrD
@Jrd the line I want to delete is the one I select. According to the line I select, the button must delete
– Bruno
And this line is already being marked with the class "coloring", right?
– JrD
@Jrd yes, is marked with that class
– Bruno
You want each row to have a delete button or a checkbox that you choose which records you want to delete?
– Joao Benthin
@Joao Benthin , I don’t want a button on each line, I want that button I put up, which is inside the div header. But you can also have the option to select with a checkbox the ones I want to delete. See here in the image, select the line and then click the button link
– Bruno
@Bruno Should this record also be removed from the database? If yes, you already have a function for this or know how to do this removal?
– JrD
@Jrd but if not remove from database, then when refresh page appears again or not?
– Bruno
@Bruno Yes, when update will return. The problem is that, in my opinion, your problem is very wide, we will have to develop the whole function for you... Have you tried to do this removal? Have you had any difficulty at all? If you have put your code, we can help you with the problems and even improve your code.
– JrD
@Jrd the part of php I know how to do, the problem is when selecting the line as I inform the button that is that line that has to delete.
– Bruno
Please do not edit your question based on one or more answers. The questions here should be focused, ideally so that they can help other users. If so, ask a new question, and in it give the details of where you are.
– bfavaretto
@bfavaretto ok, thanks for the info, so I’ll remove that issue I asked the question
– Bruno
I’ve already done it :)
– bfavaretto