Hey guys I am trying to make a button that will open and close based on if it is clicked the first time – it opens, if the second time – it closes and resets.
Here is my code I have so far – it only opens and wont close:
var val;
$(".confirmed").click(function(){
if (val == 1){
hide();
}
val = 1;
$(".confirmedtable").show();
$(".searchconfirmed").show();
});
function hide(){
$(".confirmedtable").hide();
$(".searchconfirmed").hide();
val = 0;
}
Thanks
FIDDLE