简体   繁体   中英

How to open popup automatically without clicking

Hello I have popup which is open on

<a class="btn btn-success" style="margin-bottom:10px"
   onclick="ShowPopup('@Url.Action("AddEdit","PurchaseItems", new { purchaseId = Model.purchaseId ,cust = Model.customerId , org = Model.organizationId})')">
  <i class="fa fa-plus"></i>Add New Purchase Item</a>

How can I open this same thing without click automatically after page load

Use jquery and Onload function if you use sweetalart2, You can Try this out

<script>
Swal.fire({
    title: "<strong>Your Header</strong>",
        icon: "error",
        html: 'Text You Want to Give',
        showCloseButton: !0,
        showCancelButton: !0,
        focusConfirm: !1,
        confirmButtonText: feather.icons["key"].toSvg({
            class: "font-medium-1 mr-50"
        }) + "Button 1 Text",
        confirmButtonAriaLabel: "Forgot Your Password?",
        cancelButtonText: feather.icons["hexagon"].toSvg({
            class: "font-medium-1 mr-50"
        }) + "Button 2 Text",
        cancelButtonAriaLabel: "Try Again!",
        customClass: {
            confirmButton: "btn btn-primary mb-1",
            cancelButton: "btn btn-outline-danger ml-1 mb-1"
        },
        buttonsStyling: !1
});
 </script>

Dont Forget to add css and js files of SweetAlert2

Link and Examples: Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM