<td>
<a href="http://<?php echo APP_HOST; ?>/produto/edicao/<?php echo $produto->getId(); ?>" class="btn btn-info btn-sm">Editar</a>
<a href="http://<?php echo APP_HOST; ?>/produto/exclusao/<?php echo $produto->getId(); ?>" class="btn btn-danger btn-sm">Excluir</a>
</td>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function() {
$('.table tr').each(function(i,e) {
if ($('td:eq(4)', this).text() == 'Concluido') {
$(this).css({backgroundColor: 'green'});
// It doesn't works
$('.btn btn-info btn-sm').prop('disabled', false);
$('.btn btn-danger btn-sm').prop('disabled', false);
}
});
});
</script>
ASKER
<td>
<a href="http://<?php echo APP_HOST; ?>/produto/edicao/<?php echo $produto->getId(); ?>" class="btn btn-info btn-sm">Editar</a>
<a href="http://<?php echo APP_HOST; ?>/produto/exclusao/<?php echo $produto->getId(); ?>" class="btn btn-danger btn-sm">Excluir</a>
</td>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function() {
$('.table tr').each(function(i,e) {
if ($('td:eq(4)', this).text() == 'Concluido') {
$(this).css({backgroundColor: 'green'});
$('.btn', this).prop('disabled', true);
//$('.table btn', this).prop('disabled', true);
}
});
});
</script>
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
Secondly, you will need to give the selector a context so that it finds the button within the current row. The code to disable your buttons for the specific row would be:
$('.btn', this).prop('disabled', true);