I have a table with some values stored in it. In this table I also have two buttons where I can hide the values, leaving only the name of the table and another button that filters the information I want.
My problem is that the filter button is working only once, as well as changing the behavior of the other button hiding the table.
Here is the code I'm using to manipulate the buttons:
JS
$('#mostraLancamento').hide();
...
$("#filtroTrabalho").click(function(){
var idusuario = $(".filtro").attr("id");
//alert(idusuario);
$.post("filtro.php",
{'param':idusuario},
function(j) {
$('.dados').remove();
$('.conteudoAjax').load('home.php');
}, "json");
});
...
$('#ocultaLancamento').click(function(){
$('#panelLancamento').hide();
$('#ocultaLancamento').hide();
$('#mostraLancamento').show();
});
$('#mostraLancamento').click(function(){
$('#panelLancamento').show();
$('#ocultaLancamento').show();
$('#mostraLancamento').hide();
});
HTML:
<div class="pull-right">
<button type="button" class="btn btn-default btn-xs" id="ocultaLancamento">
<span class="glyphicon glyphicon-resize-small" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-xs" id="mostraLancamento">
<span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-xs" id="filtroTrabalho">
<span class="glyphicon glyphicon-filter" aria-hidden="true">
<?php
...
?>
</span>
</button>
...
Console:
XHR finished loading: POST "http://servidor/painel/filtro.php". jquery-1.9.1.js:8526
XHR finished loading: GET "http://servidor/painel/home.php". jquery-1.9.1.js:8526