基于URL中的HASH打开引导模式

Open Bootstrap modal based on a HASH in URL

本文关键字:模式 URL 中的 HASH 基于      更新时间:2023-09-26

如果URL具有带id参数的HASH,我如何在页面加载后打开delete引导模式?

示例:

http://example.com/properties#delete-86

您可以在脚本开始时执行以下操作:

// You can retrieve the id in 'matches' variable if needed
if (matches = window.location.href.match(/#delete-([0-9])+/))
{
    $('#my-modal').modal('show');
}