Get started with jquery.blockUI CDN

(MIT OR GPL-2.0) licensed

JQuerys blockUI plugin: easily blocks UI with message during long tasks or AJAX calls .

Tags:
  • block
  • overlay
  • dialog
  • modal

Stable version

Copied!

How to start using jquery.blockUI CDN


$(document).ready(function() {
  // Function to block UI
  function blockUI() {
    $.blockUI({
      message: "Please wait...",
      css: {
        border: "2px solid #a9a9a9",
        padding: "15px",
        backgroundColor: "#fff",
        left: "50%",
        top: "50%",
        marginLeft: "-78px"
      }
    });
  }

  // Function to unblock UI
  function unblockUI() {
    $.unblockUI();
  }

  // Example of blocking UI during an AJAX call
  $("#button").click(function() {
    blockUI(); // Block UI before making the AJAX call
    $.get("example.php", function(data) {
      // Process the data here
      console.log(data);
      unblockUI(); // Unblock UI after the AJAX call is complete
    });
  });
});
Copied!
Copied!

All versions