jQuery delete confirmation box

前端 未结 9 882
粉色の甜心
粉色の甜心 2020-12-24 11:26

In my jQuery am displaying my results in a table formatted output, a part of my jQuery is



        
相关标签:
9条回答
  • 2020-12-24 11:48

    Simply works as:

    $("a. close").live("click",function(event){
         return confirm("Do you want to delete?");
    });
    
    0 讨论(0)
  • 2020-12-24 11:52

    I used this:

    <a href="url/to/delete.asp" onclick="return confirm(' you want to delete?');">Delete</a>
    
    0 讨论(0)
  • 2020-12-24 11:54
    function deleteItem(this) {
        if (confirm("Are you sure?")) {
              $(this).remove();
        }
        return false;
    }
    

    You can also use jquery modalin same way

    JQuery version

    Are you sure?
      $(document).ready(function() {
        $("#dialog-box").dialog({
          autoOpen: false,
          modal: true
        });
    
      $(".close").click(function(e) {
        var currentElem = $(this);
        $("#dialog-box").dialog({
          buttons : {
            "Confirm" : function() {
              currentElem.remove()
            },
            "Cancel" : function() {
              $(this).dialog("close");
            }
          }
        });
    
        $("#dialog-box").dialog("open");
      });
    });
    
    0 讨论(0)
  • 2020-12-24 11:57

    Try with below code:

    $('.close').click(function(){
    var checkstr =  confirm('are you sure you want to delete this?');
    if(checkstr == true){
      // do your code
    }else{
    return false;
    }
    });
    

    OR

    function deleteItem(){
        var checkstr =  confirm('are you sure you want to delete this?');
        if(checkstr == true){
          // do your code
        }else{
        return false;
        }
      }
    

    This may work for you..

    Thanks.

    0 讨论(0)
  • 2020-12-24 12:01
    $(document).ready(function(){
      $(".del").click(function(){
        if (!confirm("Do you want to delete")){
          return false;
        }
      });
    });
    
    0 讨论(0)
  • 2020-12-24 12:05

    Try this my friend

      // Confirmation Message On Delete Button.
    
      $('.close').click(function() {
        return confirm('Are You Sure ?')
      });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <td class='close'></td>

    0 讨论(0)
提交回复
热议问题