行为不当

时间:2019-05-15 17:25:43

标签: modal-dialog alert sweetalert sweet.js

每当我点击swal内的“确定”按钮时,后面的主网页就会变得无响应。

<button id="myBtn" onclick="myFunction()">Click me</button>
function myFunction(){
  swal({
  title: "About Murli!",
  text: "Select the Month or Year, or both and then click on the Search button to get the list.",
  icon: "info",
  button: {
    text: "OK",
    value: true,
    visible: true,
    className: "",
    closeModal: true,
    closeOnClickOutside: true,
    closeOnEsc: true,
  },
  timer: 3000,
});
}````

The alert box opens correctly but after clicking on OK, the main page becomes unresponsive.

1 个答案:

答案 0 :(得分:0)

swal({
  title: "About Murli!",
  text: "Select the Month or Year, or both and then click on the Search button to get the list.",
  icon: "info",
  button: {
    text: "OK",
    value: true,
    visible: true,
    className: "",
    closeModal: true,
    closeOnClickOutside: true,
    closeOnEsc: true,
  },
  timer: 3000,
}).done(function(){
    swal.close();
});

尝试上面的代码。