1
I have a code that when you click the deactivate button, asks you why you’re deactivating the photo. When you confirm that motive, he should disappear the button on the side. I have a code with javascript to do the whole part of asking the reason for the photo deactivation, but I have no idea how to make the next button disappear.
This is the javascript code:
$(document).on('click','.desativar', function(){
  var t = $(this);
  $.SmartMessageBox({
    title : "<?= $this->lang->line("con_inflaud_jus_msg_title"); ?>",
    content : "<?= $this->lang->line("con_inflaud_jus_msg_d"); ?>",
    buttons : "[<?= $this->lang->line("con_inflaud_jus_msg_btn_n"); ?>][<?= $this->lang->line("con_inflaud_jus_msg_btn_y"); ?>]",
    input : "text",
    inputValue: "",
    placeholder : "<?= $this->lang->line("con_inflaud_jus_msg_place"); ?>"
  }, function(ButtonPress, Value) {
    if(ButtonPress == "<?= $this->lang->line("con_inflaud_jus_msg_btn_n"); ?>"){
      return 0;
    }else{
      if(Value == ""){
        notifica('<?= $this->lang->line("con_inflaud_msg_erro_title"); ?>', '<?= $this->lang->line("con_inflaud_jus_msg_inpmpt"); ?>', 4000);
      }else{
        $.ajax({
          type: "POST",
          url: "Controller/Funcao/" + $(t).attr('id') + "/0",
          data: {justificativa: Value},
          dataType: "json",
          success: function(r) {
            if(r) {
              $(t).parent().parent().next().find('.msg_des').show();
              $(t).parent().parent().next().find('.graf_lau').css('display','none');
              $(t).parent().parent().next().find('blockquote > .graf_lau').css('display','block');
              $(t).parent().parent().next().find('.img_lau_d').show();
              $(t).parent().parent().next().find('.img_lau_a').css('display','none');
              $(t).removeClass('desabilitar btn-danger');
              $(t).addClass('habilitar btn-success');
              $(t).empty();
              $(t).append('<span class="btn-label"><i class="glyphicon glyphicon-ok"></i></span><?= $this->lang->line("view_inflaud_iten_btn_h"); ?>');
            } else {
              notifica('<?= $this->lang->line("con_inflaud_msg_erro_title"); ?>', '<?= $this->lang->line("con_inflaud_msg_erro_d"); ?>', 4000);
            }
          }
        });
      }
    }
  });
});
It can be done like this
document.getElementById("myBtn").style.display="none";
just changemyBtnforidof your button– Gabriel Rodrigues
detail, this
.css('display','none');and the same thing only that injqueryprobably your selector is not being found.– Gabriel Rodrigues
@Gabrielrodrigues this code you sent me worked, thank you very much, but this button repeats, if I call him by id will only work for the first time.
– Ketlin
As this button repeats, clicking disable will "disappear" all buttons or just one?
– Randrade
You can display the HTML of both buttons?
– Sergio