单击后,当前选项卡不显示弹出

时间:2019-01-26 09:13:18

标签: jquery

我有一组选项卡,当我单击它们时,其中一个包含一个按钮。我可以编辑信息,但是如果您要转到另一个选项卡,则可以看到“弹出”。我有一个问题,当您单击具有按钮的相同选项卡并退出另一个选项卡时,不会出现弹出窗口!


let editButtonHandler = false;
  let showPopUp = false;
  let canMove = true;
  $(document).ready(function()
  {
    //hide Cancel Button.
    $("#CancelBtn").hide();

    $("#editBtnProfile").click(function()
    {
      //click on Edit and show Cancel.
      if (showPopUp)
      {
        editButtonHandler = !editButtonHandler;
        $("#CancelBtn").show();
      }
    });
    $("#CancelBtn").click(function()
    {
      //click on Cancel after click on edit.
      if (showPopUp ) {
        editButtonHandler = false;
        showPopUp = false;
      }
    });
    $("#navTabs").click(function()
    {
      if (showPopUp && editButtonHandler)
      {
        disabledEditBtn();
        disableInput();
        $("#CancelBtn").css("visibility", "hidden");
        canMove = confirm("You have unsaved changes. Are you sure you want to continue?");
        $('#editBtnProfile').text('Edit Profile');
      }
    });
    $('#navTabs li').click(function(event){
      if(event.currentTarget.id === 'biotab') {
        showPopUp = true;
        editButtonHandler = false;
      } else if (!editButtonHandler){
        showPopUp = true;
        $("#CancelBtn").css("visibility", "hidden");
      }
    });
  });

0 个答案:

没有答案